inject data into an open connection.
(tctx)
| 104 | |
| 105 | |
| 106 | def test_inject(tctx): |
| 107 | """inject data into an open connection.""" |
| 108 | f = Placeholder(UDPFlow) |
| 109 | |
| 110 | assert ( |
| 111 | Playbook(udp.UDPLayer(tctx)) |
| 112 | << udp.UdpStartHook(f) |
| 113 | >> UdpMessageInjected(f, UDPMessage(True, b"hello!")) |
| 114 | >> reply(to=-2) |
| 115 | << OpenConnection(tctx.server) |
| 116 | >> reply(None) |
| 117 | << udp.UdpMessageHook(f) |
| 118 | >> reply() |
| 119 | << SendData(tctx.server, b"hello!") |
| 120 | # and the other way... |
| 121 | >> UdpMessageInjected( |
| 122 | f, UDPMessage(False, b"I have already done the greeting for you.") |
| 123 | ) |
| 124 | << udp.UdpMessageHook(f) |
| 125 | >> reply() |
| 126 | << SendData(tctx.client, b"I have already done the greeting for you.") |
| 127 | << None |
| 128 | ) |
| 129 | assert len(f().messages) == 2 |
nothing calls this directly
no test coverage detected
searching dependent graphs…