From 1e3f1b4d2bd7f82dd4ad6879c2beaecdfe209bc8 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 3 Apr 2020 12:05:06 +0200 Subject: fix tls test on Windows --- test/mitmproxy/test_connections.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/mitmproxy/test_connections.py b/test/mitmproxy/test_connections.py index 7c371c1e..ae296631 100644 --- a/test/mitmproxy/test_connections.py +++ b/test/mitmproxy/test_connections.py @@ -199,6 +199,9 @@ class TestClientConnectionTLS: s = socket.create_connection(address) s = ctx.wrap_socket(s, server_hostname=sni) s.send(b'foobar') + # we need to wait for the test to finish successfully before calling .close() on Windows. + # The workaround here is to signal completion by sending data the other way around. + s.recv(3) s.close() threading.Thread(target=client_run).start() @@ -216,6 +219,7 @@ class TestClientConnectionTLS: assert c.sni == sni assert c.tls_established assert c.rfile.read(6) == b'foobar' + c.wfile.send(b"foo") c.finish() sock.close() -- cgit v1.2.3