diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-07-03 02:48:35 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-07-03 02:48:35 +0200 |
commit | 4ef83d8c114a5359b0fc26c3c13753022943a4c5 (patch) | |
tree | 4ce7bb28e60d6dd78582c63c2ed2f44879ba39d5 /test/test_pathoc.py | |
parent | 4407508e0ce971b03358877844d409e16b244562 (diff) | |
download | mitmproxy-4ef83d8c114a5359b0fc26c3c13753022943a4c5.tar.gz mitmproxy-4ef83d8c114a5359b0fc26c3c13753022943a4c5.tar.bz2 mitmproxy-4ef83d8c114a5359b0fc26c3c13753022943a4c5.zip |
pathoc: add socks connect
Diffstat (limited to 'test/test_pathoc.py')
-rw-r--r-- | test/test_pathoc.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test/test_pathoc.py b/test/test_pathoc.py index 6b037bcc..fb8d348a 100644 --- a/test/test_pathoc.py +++ b/test/test_pathoc.py @@ -4,7 +4,7 @@ import re import OpenSSL from mock import Mock -from netlib import tcp, http, http2 +from netlib import tcp, http, http2, socks from libpathod import pathoc, test, version, pathod, language import tutils @@ -230,6 +230,29 @@ class TestDaemon(_TestDaemon): ) c.http_connect(to) + def test_socks_connect(self): + to = ("foobar", 80) + c = pathoc.Pathoc(("127.0.0.1", self.d.port), fp=None) + c.rfile, c.wfile = tutils.treader(""), cStringIO.StringIO() + tutils.raises(pathoc.PathocError, c.socks_connect, to) + + c.rfile = tutils.treader( + "\x05\xEE" + ) + tutils.raises("SOCKS without authentication", c.socks_connect, ("example.com", 0xDEAD)) + + c.rfile = tutils.treader( + "\x05\x00" + + "\x05\xEE\x00\x03\x0bexample.com\xDE\xAD" + ) + tutils.raises("SOCKS server error", c.socks_connect, ("example.com", 0xDEAD)) + + c.rfile = tutils.treader( + "\x05\x00" + + "\x05\x00\x00\x03\x0bexample.com\xDE\xAD" + ) + c.socks_connect(("example.com", 0xDEAD)) + class TestDaemonHTTP2(_TestDaemon): ssl = True |