aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2017-12-29 21:55:41 +0100
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2017-12-29 22:51:13 +0100
commit59c277effd016fdf771a65aaaa87526ff5fe869e (patch)
treee25085b994a4033daad1de32c754f78344de6593
parent43c74ff1ef72888f4d12e7c52f3dadee6499fc04 (diff)
downloadmitmproxy-59c277effd016fdf771a65aaaa87526ff5fe869e.tar.gz
mitmproxy-59c277effd016fdf771a65aaaa87526ff5fe869e.tar.bz2
mitmproxy-59c277effd016fdf771a65aaaa87526ff5fe869e.zip
websocket: add flow kill 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..490d31a0 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()
+
+ frame = websockets.Frame.from_file(self.client.rfile)
+ assert frame.payload == b'foo'
+
+
class TestSimpleTLS(_WebSocketTest):
ssl = True