inject data into an open connection.
(tctx)
| 126 | |
| 127 | |
| 128 | def test_inject(tctx): |
| 129 | """inject data into an open connection.""" |
| 130 | f = Placeholder(TCPFlow) |
| 131 | |
| 132 | assert ( |
| 133 | Playbook(tcp.TCPLayer(tctx)) |
| 134 | << tcp.TcpStartHook(f) |
| 135 | >> TcpMessageInjected(f, TCPMessage(True, b"hello!")) |
| 136 | >> reply(to=-2) |
| 137 | << OpenConnection(tctx.server) |
| 138 | >> reply(None) |
| 139 | << tcp.TcpMessageHook(f) |
| 140 | >> reply() |
| 141 | << SendData(tctx.server, b"hello!") |
| 142 | # and the other way... |
| 143 | >> TcpMessageInjected( |
| 144 | f, TCPMessage(False, b"I have already done the greeting for you.") |
| 145 | ) |
| 146 | << tcp.TcpMessageHook(f) |
| 147 | >> reply() |
| 148 | << SendData(tctx.client, b"I have already done the greeting for you.") |
| 149 | << None |
| 150 | ) |
| 151 | assert len(f().messages) == 2 |
nothing calls this directly
no test coverage detected
searching dependent graphs…