MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_protocol_error

Function test_protocol_error

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

Source from the content-addressed store, hash-verified

308
309
310def test_protocol_error(ws_testdata):
311 tctx, playbook, flow = ws_testdata
312 assert (
313 playbook
314 << websocket.WebsocketStartHook(flow)
315 >> reply()
316 >> DataReceived(tctx.server, b"\x01\x03foo")
317 >> DataReceived(tctx.server, b"\x02\x03bar")
318 << SendData(
319 tctx.server,
320 masked(b"\x88/\x03\xeaexpected CONTINUATION, got <Opcode.BINARY: 2>"),
321 )
322 << CloseConnection(tctx.server)
323 << SendData(
324 tctx.client, b"\x88/\x03\xeaexpected CONTINUATION, got <Opcode.BINARY: 2>"
325 )
326 << CloseConnection(tctx.client)
327 << websocket.WebsocketEndHook(flow)
328 >> reply()
329 )
330 assert not flow.websocket.messages
331 assert not flow.live
332
333
334def test_ping(ws_testdata):

Callers

nothing calls this directly

Calls 5

replyClass · 0.90
DataReceivedClass · 0.90
SendDataClass · 0.90
CloseConnectionClass · 0.90
maskedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…