MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_ping

Function test_ping

test/mitmproxy/proxy/layers/test_websocket.py:334–347  ·  view source on GitHub ↗
(ws_testdata)

Source from the content-addressed store, hash-verified

332
333
334def test_ping(ws_testdata):
335 tctx, playbook, flow = ws_testdata
336 assert (
337 playbook
338 << websocket.WebsocketStartHook(flow)
339 >> reply()
340 >> DataReceived(tctx.client, masked_bytes(b"\x89\x11ping-with-payload"))
341 << Log("Received WebSocket ping from client (payload: b'ping-with-payload')")
342 << SendData(tctx.server, masked(b"\x89\x11ping-with-payload"))
343 >> DataReceived(tctx.server, b"\x8a\x11pong-with-payload")
344 << Log("Received WebSocket pong from server (payload: b'pong-with-payload')")
345 << SendData(tctx.client, b"\x8a\x11pong-with-payload")
346 )
347 assert not flow.websocket.messages
348
349
350def test_close_normal(ws_testdata):

Callers

nothing calls this directly

Calls 6

replyClass · 0.90
DataReceivedClass · 0.90
LogClass · 0.90
SendDataClass · 0.90
masked_bytesFunction · 0.85
maskedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…