aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_tcp.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-02-27 18:35:16 +1300
committerAldo Cortesi <aldo@nullcube.com>2014-02-27 18:35:16 +1300
commit3443bae94e090b0bf12005ef4f0ca474bd903fb1 (patch)
treea6645c6745a7ca2c0922985c66a94f1188eef175 /test/test_tcp.py
parent0e867adcf232b8a138dfc3f929aa5b8987576de5 (diff)
downloadmitmproxy-3443bae94e090b0bf12005ef4f0ca474bd903fb1.tar.gz
mitmproxy-3443bae94e090b0bf12005ef4f0ca474bd903fb1.tar.bz2
mitmproxy-3443bae94e090b0bf12005ef4f0ca474bd903fb1.zip
Cipher suite selection for client connections, improved error handling
Diffstat (limited to 'test/test_tcp.py')
-rw-r--r--test/test_tcp.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/test_tcp.py b/test/test_tcp.py
index 525961d5..9c15e2eb 100644
--- a/test/test_tcp.py
+++ b/test/test_tcp.py
@@ -219,7 +219,7 @@ class TestSNI(test.ServerTestBase):
assert c.rfile.readline() == "foo.com"
-class TestClientCipherList(test.ServerTestBase):
+class TestServerCipherList(test.ServerTestBase):
handler = ClientCipherListHandler
ssl = dict(
cert = tutils.test_data.path("data/server.crt"),
@@ -235,6 +235,36 @@ class TestClientCipherList(test.ServerTestBase):
assert c.rfile.readline() == "['RC4-SHA']"
+class TestServerCipherListError(test.ServerTestBase):
+ handler = ClientCipherListHandler
+ ssl = dict(
+ cert = tutils.test_data.path("data/server.crt"),
+ key = tutils.test_data.path("data/server.key"),
+ request_client_cert = False,
+ v3_only = False,
+ cipher_list = 'bogus'
+ )
+ def test_echo(self):
+ c = tcp.TCPClient(("127.0.0.1", self.port))
+ c.connect()
+ tutils.raises("handshake error", c.convert_to_ssl, sni="foo.com")
+
+
+class TestClientCipherListError(test.ServerTestBase):
+ handler = ClientCipherListHandler
+ ssl = dict(
+ cert = tutils.test_data.path("data/server.crt"),
+ key = tutils.test_data.path("data/server.key"),
+ request_client_cert = False,
+ v3_only = False,
+ cipher_list = 'RC4-SHA'
+ )
+ def test_echo(self):
+ c = tcp.TCPClient(("127.0.0.1", self.port))
+ c.connect()
+ tutils.raises("cipher specification", c.convert_to_ssl, sni="foo.com", cipher_list="bogus")
+
+
class TestSSLDisconnect(test.ServerTestBase):
handler = DisconnectHandler
ssl = dict(