mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-01 07:49:10 +00:00
make tests aware of ALPN & OpenSSL 1.0.2 dependency
This commit is contained in:
parent
c32d8189fa
commit
629fa8e552
@ -4,11 +4,14 @@ import time
|
|||||||
import socket
|
import socket
|
||||||
import random
|
import random
|
||||||
import os
|
import os
|
||||||
from netlib import tcp, certutils, test, certffi
|
|
||||||
import threading
|
import threading
|
||||||
import mock
|
import mock
|
||||||
import tutils
|
|
||||||
from OpenSSL import SSL
|
from OpenSSL import SSL
|
||||||
|
import OpenSSL
|
||||||
|
|
||||||
|
from netlib import tcp, certutils, test, certffi
|
||||||
|
import tutils
|
||||||
|
|
||||||
|
|
||||||
class EchoHandler(tcp.BaseHandler):
|
class EchoHandler(tcp.BaseHandler):
|
||||||
@ -399,12 +402,14 @@ class TestALPN(test.ServerTestBase):
|
|||||||
alpn_select="h2"
|
alpn_select="h2"
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_alpn(self):
|
if OpenSSL._util.lib.Cryptography_HAS_ALPN:
|
||||||
c = tcp.TCPClient(("127.0.0.1", self.port))
|
|
||||||
c.connect()
|
def test_alpn(self):
|
||||||
c.convert_to_ssl(alpn_protos=["h2"])
|
c = tcp.TCPClient(("127.0.0.1", self.port))
|
||||||
print "ALPN: %s" % c.get_alpn_proto_negotiated()
|
c.connect()
|
||||||
assert c.get_alpn_proto_negotiated() == "h2"
|
c.convert_to_ssl(alpn_protos=["h2"])
|
||||||
|
print "ALPN: %s" % c.get_alpn_proto_negotiated()
|
||||||
|
assert c.get_alpn_proto_negotiated() == "h2"
|
||||||
|
|
||||||
|
|
||||||
class TestSSLTimeOut(test.ServerTestBase):
|
class TestSSLTimeOut(test.ServerTestBase):
|
||||||
|
Loading…
Reference in New Issue
Block a user