+ // 1.3. Send a RST packet
+ TCP_Send(0, 4, BLOB(TEST_IP), 1234, 80, seq_tx, seq_exp, TCP_RST, 0x1000, 0, NULL);
+ // Expect nothing
+ TEST_ASSERT( Net_Receive(0, sizeof(rxbuf), rxbuf, NRX_TIMEOUT) == 0 );
+
+ // 1.3. Send a RST,ACK packet
+ TCP_Send(0, 4, BLOB(TEST_IP), 1234, 80, seq_tx, seq_exp, TCP_RST|TCP_ACK, 0x1000, 0, NULL);
+ // Expect nothing
+ TEST_ASSERT_no_rx();
+
+
+ // 2. Establishing connection with a server
+ const int server_port = 1024;
+ const int local_port = 11234;
+ Stack_SendCommand("tcp_echo_server %i", server_port);
+
+ // >>> STATE: LISTEN
+
+ // 2.1. Send RST
+ TCP_Send(0, 4, BLOB(TEST_IP), local_port, server_port, seq_tx, seq_exp, TCP_RST, our_window, 0, NULL);
+ // - Expect nothing
+ TEST_ASSERT_no_rx();
+ // 2.2. Send ACK
+ TCP_Send(0, 4, BLOB(TEST_IP), local_port, server_port, seq_tx, seq_exp, TCP_ACK, our_window, 0, NULL);
+ // - Expect RST
+ TEST_ASSERT_rx();
+ TEST_ASSERT( TCP_Pkt_Check(rxlen, rxbuf, &ofs, 4, BLOB(TEST_IP), 80, 1234, seq_exp, seq_tx+0, TCP_RST) );
+
+ // 2.3. Begin hanshake (SYN)
+ // TODO: "If the SYN bit is set, check the security."
+ TCP_Send(0, 4, BLOB(TEST_IP), local_port, server_port, seq_tx, 0, TCP_SYN, our_window, 0, NULL);
+ // - Expect SYN,ACK with ACK == SEQ+1
+ TEST_ASSERT_rx();
+ TCP_SkipCheck_Seq(true);
+ TEST_ASSERT( TCP_Pkt_Check(rxlen, rxbuf, &ofs, 4, BLOB(TEST_IP), server_port, local_port,
+ 0, seq_tx+1, TCP_SYN|TCP_ACK) );
+ seq_exp = TCP_Pkt_GetSeq(rxlen, rxbuf, 4);
+
+ // >>> STATE: SYN-RECEIVED
+ // TODO: Test other transitions from SYN-RECEIVED
+
+ // 2.4. Complete handshake, TCP ACK
+ TCP_Send(0,4,BLOB(TEST_IP), local_port, server_port, seq_tx, seq_exp, TCP_ACK, our_window, 0, NULL);
+ // - Expect nothing
+ TEST_ASSERT( Net_Receive(0, sizeof(rxbuf), rxbuf, NRX_TIMEOUT) == 0 );
+
+ // >>> STATE: ESTABLISHED
+
+ // 2.5. Send data
+