aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_pathoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_pathoc.py')
-rw-r--r--test/test_pathoc.py25
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