aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-12-29 23:33:37 +0100
committerGitHub <noreply@github.com>2017-12-29 23:33:37 +0100
commit0b80fd00d458b98e700a78be1ab9a586bf45900b (patch)
treebb86ed2d55822470608568115ce41ce51c6edba8 /test
parent43c74ff1ef72888f4d12e7c52f3dadee6499fc04 (diff)
parent62326227740d3808c0886ed381cb976a6b2f8b03 (diff)
downloadmitmproxy-0b80fd00d458b98e700a78be1ab9a586bf45900b.tar.gz
mitmproxy-0b80fd00d458b98e700a78be1ab9a586bf45900b.tar.bz2
mitmproxy-0b80fd00d458b98e700a78be1ab9a586bf45900b.zip
Merge pull request #2732 from mitmproxy/websocket-flow-kill
fix flow.kill
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/proxy/protocol/test_websocket.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/mitmproxy/proxy/protocol/test_websocket.py b/test/mitmproxy/proxy/protocol/test_websocket.py
index a7acdc4d..d9389faf 100644
--- a/test/mitmproxy/proxy/protocol/test_websocket.py
+++ b/test/mitmproxy/proxy/protocol/test_websocket.py
@@ -221,6 +221,25 @@ class TestSimple(_WebSocketTest):
assert frame.payload == b'foo'
+class TestKillFlow(_WebSocketTest):
+
+ @classmethod
+ def handle_websockets(cls, rfile, wfile):
+ wfile.write(bytes(websockets.Frame(fin=1, opcode=websockets.OPCODE.TEXT, payload=b'server-foobar')))
+ wfile.flush()
+
+ def test_kill(self):
+ class KillFlow:
+ def websocket_message(self, f):
+ f.kill()
+
+ self.master.addons.add(KillFlow())
+ self.setup_connection()
+
+ with pytest.raises(exceptions.TcpDisconnect):
+ websockets.Frame.from_file(self.client.rfile)
+
+
class TestSimpleTLS(_WebSocketTest):
ssl = True