aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_socks.py2
-rw-r--r--test/test_tcp.py20
2 files changed, 11 insertions, 11 deletions
diff --git a/test/test_socks.py b/test/test_socks.py
index dd8e2807..d95dee41 100644
--- a/test/test_socks.py
+++ b/test/test_socks.py
@@ -121,7 +121,7 @@ def test_message_ipv4():
def test_message_ipv6():
# Test ATYP=0x04 (IPV6)
- ipv6_addr = "2001:db8:85a3:8d3:1319:8a2e:370:7344"
+ ipv6_addr = u"2001:db8:85a3:8d3:1319:8a2e:370:7344"
raw = tutils.treader(
b"\x05\x01\x00\x04" +
diff --git a/test/test_tcp.py b/test/test_tcp.py
index dc0efeb0..725aa8b0 100644
--- a/test/test_tcp.py
+++ b/test/test_tcp.py
@@ -49,9 +49,9 @@ class ALPNHandler(tcp.BaseHandler):
def handle(self):
alp = self.get_alpn_proto_negotiated()
if alp:
- self.wfile.write("%s" % alp)
+ self.wfile.write(("%s" % alp).encode("ascii"))
else:
- self.wfile.write("NONE")
+ self.wfile.write(b"NONE")
self.wfile.flush()
@@ -503,24 +503,24 @@ class TestALPNClient(tservers.ServerTestBase):
def test_alpn(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
- c.convert_to_ssl(alpn_protos=["foo", "bar", "fasel"])
- assert c.get_alpn_proto_negotiated() == "bar"
- assert c.rfile.readline().strip() == "bar"
+ c.convert_to_ssl(alpn_protos=[b"foo", b"bar", b"fasel"])
+ assert c.get_alpn_proto_negotiated() == b"bar"
+ assert c.rfile.readline().strip() == b"bar"
def test_no_alpn(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
c.convert_to_ssl()
- assert c.get_alpn_proto_negotiated() == ""
- assert c.rfile.readline().strip() == "NONE"
+ assert c.get_alpn_proto_negotiated() == b""
+ assert c.rfile.readline().strip() == b"NONE"
else:
def test_none_alpn(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
- c.convert_to_ssl(alpn_protos=["foo", "bar", "fasel"])
- assert c.get_alpn_proto_negotiated() == ""
- assert c.rfile.readline() == "NONE"
+ c.convert_to_ssl(alpn_protos=[b"foo", b"bar", b"fasel"])
+ assert c.get_alpn_proto_negotiated() == b""
+ assert c.rfile.readline() == b"NONE"
class TestNoSSLNoALPNClient(tservers.ServerTestBase):