aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--netlib/tcp.py5
-rw-r--r--test/test_tcp.py8
2 files changed, 11 insertions, 2 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py
index fc2ce115..09c43ffc 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -499,7 +499,10 @@ class TCPClient(_Connection):
return self.connection.gettimeout()
def get_alpn_proto_negotiated(self):
- return self.connection.get_alpn_proto_negotiated()
+ if OpenSSL._util.lib.Cryptography_HAS_ALPN:
+ return self.connection.get_alpn_proto_negotiated()
+ else:
+ return None
class BaseHandler(_Connection):
diff --git a/test/test_tcp.py b/test/test_tcp.py
index f8fc6a28..d5506556 100644
--- a/test/test_tcp.py
+++ b/test/test_tcp.py
@@ -370,13 +370,19 @@ class TestALPN(test.ServerTestBase):
)
if OpenSSL._util.lib.Cryptography_HAS_ALPN:
-
def test_alpn(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
c.convert_to_ssl(alpn_protos=["foobar"])
assert c.get_alpn_proto_negotiated() == "foobar"
+ else:
+ def test_none_alpn(self):
+ c = tcp.TCPClient(("127.0.0.1", self.port))
+ c.connect()
+ c.convert_to_ssl(alpn_protos=["foobar"])
+ assert c.get_alpn_proto_negotiated() == None
+
class TestSSLTimeOut(test.ServerTestBase):
handler = HangHandler