예제 #1
0
def open_h2_server_conn():
    # this is a bit fake here (port 80, with alpn, but no tls - c'mon),
    # but we don't want to pollute our tests with TLS handshakes.
    s = Server(("example.com", 80))
    s.state = ConnectionState.OPEN
    s.alpn = b"h2"
    return s
예제 #2
0
 def test_basic(self):
     s = Server(("address", 22))
     assert repr(s)
     assert str(s)
     s.timestamp_tls_setup = 1607780791
     assert str(s)
     s.alpn = b"foo"
     s.sockname = ("127.0.0.1", 54321)
     assert str(
         s) == "Server(address:22, state=closed, alpn=foo, src_port=54321)"