'When a client specifies no server name, the callback passed to
:py:obj:`Context.set_tlsext_servername_callback` is invoked and the result of
:py:obj:`Connection.get_servername` is :py:obj:`None`.'

def test_no_servername(self):

    args = []
    def servername(conn):
        args.append((conn, conn.get_servername()))
    context = Context(TLSv1_METHOD)
    context.set_tlsext_servername_callback(servername)
    del servername
    collect()
    context.use_privatekey(load_privatekey(FILETYPE_PEM, server_key_pem))
    context.use_certificate(load_certificate(FILETYPE_PEM, server_cert_pem))
    server = Connection(context, None)
    server.set_accept_state()
    client = Connection(Context(TLSv1_METHOD), None)
    client.set_connect_state()
    self._interactInMemory(server, client)
    self.assertEqual([(server, None)], args)
