open connection, receive data, send it to peer
(tctx)
| 41 | |
| 42 | |
| 43 | def test_simple(tctx): |
| 44 | """open connection, receive data, send it to peer""" |
| 45 | f = Placeholder(TCPFlow) |
| 46 | |
| 47 | assert ( |
| 48 | Playbook(tcp.TCPLayer(tctx)) |
| 49 | << tcp.TcpStartHook(f) |
| 50 | >> reply() |
| 51 | << OpenConnection(tctx.server) |
| 52 | >> reply(None) |
| 53 | >> DataReceived(tctx.client, b"hello!") |
| 54 | << tcp.TcpMessageHook(f) |
| 55 | >> reply() |
| 56 | << SendData(tctx.server, b"hello!") |
| 57 | >> DataReceived(tctx.server, b"hi") |
| 58 | << tcp.TcpMessageHook(f) |
| 59 | >> reply() |
| 60 | << SendData(tctx.client, b"hi") |
| 61 | >> ConnectionClosed(tctx.server) |
| 62 | << CloseTcpConnection(tctx.client, half_close=True) |
| 63 | >> ConnectionClosed(tctx.client) |
| 64 | << CloseConnection(tctx.server) |
| 65 | << tcp.TcpEndHook(f) |
| 66 | >> reply() |
| 67 | >> ConnectionClosed(tctx.client) |
| 68 | << None |
| 69 | ) |
| 70 | assert len(f().messages) == 2 |
| 71 | |
| 72 | |
| 73 | def test_receive_data_before_server_connected(tctx): |
nothing calls this directly
no test coverage detected
searching dependent graphs…