def test_alpn_no_server(self):
    "\n            When clients and servers cannot agree on what protocol to use next\n            because the server doesn't offer ALPN, no protocol is negotiated.\n            "
    client_context = Context(TLSv1_METHOD)
    client_context.set_alpn_protos([b'http/1.1', b'spdy/2'])
    server_context = Context(TLSv1_METHOD)
    server_context.use_privatekey(load_privatekey(FILETYPE_PEM, server_key_pem))
    server_context.use_certificate(load_certificate(FILETYPE_PEM, server_cert_pem))
    server = Connection(server_context, None)
    server.set_accept_state()
    client = Connection(client_context, None)
    client.set_connect_state()
    interact_in_memory(server, client)
    assert (client.get_alpn_proto_negotiated() == b'')
When clients and servers cannot agree on what protocol to use next
because the server doesn't offer ALPN, no protocol is negotiated.
def test_alpn_no_server(self):
    "\n            When clients and servers cannot agree on what protocol to use next\n            because the server doesn't offer ALPN, no protocol is negotiated.\n            "
    client_context = Context(TLSv1_METHOD)
    client_context.set_alpn_protos([b'http/1.1', b'spdy/2'])
    server_context = Context(TLSv1_METHOD)
    server_context.use_privatekey(load_privatekey(FILETYPE_PEM, server_key_pem))
    server_context.use_certificate(load_certificate(FILETYPE_PEM, server_cert_pem))
    server = Connection(server_context, None)
    server.set_accept_state()
    client = Connection(client_context, None)
    client.set_connect_state()
    interact_in_memory(server, client)
    assert (client.get_alpn_proto_negotiated() == b)