MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_udp_start_stop

Function test_udp_start_stop

test/mitmproxy/proxy/test_mode_servers.py:325–345  ·  view source on GitHub ↗
(caplog_async)

Source from the content-addressed store, hash-verified

323
324
325async def test_udp_start_stop(caplog_async):
326 caplog_async.set_level("INFO")
327 manager = MagicMock()
328 manager.connections = {}
329
330 with taddons.context():
331 inst = ServerInstance.make("dns@127.0.0.1:0", manager)
332 await inst.start()
333 assert await caplog_async.await_log("server listening")
334
335 host, port, *_ = inst.listen_addrs[0]
336 stream = await mitmproxy_rs.udp.open_udp_connection(host, port)
337
338 stream.write(b"\x00\x00\x01")
339 assert await caplog_async.await_log("sent an invalid message")
340
341 stream.close()
342 await stream.wait_closed()
343
344 await inst.stop()
345 assert await caplog_async.await_log("stopped")
346
347
348async def test_udp_start_error():

Callers

nothing calls this directly

Calls 8

set_levelMethod · 0.80
contextMethod · 0.80
await_logMethod · 0.80
makeMethod · 0.45
startMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…