mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-02 18:57:22 +00:00
websocket: update close handshake tests
This commit is contained in:
parent
d2216801dd
commit
cc6aa1f542
1 changed files with 4 additions and 0 deletions
|
|
@ -276,6 +276,7 @@ class TestClose(_WebSocketTest):
|
|||
def handle_websockets(cls, rfile, wfile):
|
||||
frame = websockets.Frame.from_file(rfile)
|
||||
wfile.write(bytes(frame))
|
||||
wfile.write(bytes(websockets.Frame(fin=1, opcode=websockets.OPCODE.CLOSE)))
|
||||
wfile.flush()
|
||||
|
||||
with pytest.raises(exceptions.TcpDisconnect):
|
||||
|
|
@ -287,6 +288,7 @@ class TestClose(_WebSocketTest):
|
|||
client.wfile.write(bytes(websockets.Frame(fin=1, opcode=websockets.OPCODE.CLOSE)))
|
||||
client.wfile.flush()
|
||||
|
||||
websockets.Frame.from_file(client.rfile)
|
||||
with pytest.raises(exceptions.TcpDisconnect):
|
||||
websockets.Frame.from_file(client.rfile)
|
||||
|
||||
|
|
@ -296,6 +298,7 @@ class TestClose(_WebSocketTest):
|
|||
client.wfile.write(bytes(websockets.Frame(fin=1, opcode=websockets.OPCODE.CLOSE, payload=b'\00\42')))
|
||||
client.wfile.flush()
|
||||
|
||||
websockets.Frame.from_file(client.rfile)
|
||||
with pytest.raises(exceptions.TcpDisconnect):
|
||||
websockets.Frame.from_file(client.rfile)
|
||||
|
||||
|
|
@ -305,6 +308,7 @@ class TestClose(_WebSocketTest):
|
|||
client.wfile.write(bytes(websockets.Frame(fin=1, opcode=websockets.OPCODE.CLOSE, payload=b'\00\42foobar')))
|
||||
client.wfile.flush()
|
||||
|
||||
websockets.Frame.from_file(client.rfile)
|
||||
with pytest.raises(exceptions.TcpDisconnect):
|
||||
websockets.Frame.from_file(client.rfile)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue