'Hostnames are encoded as IDNA.'

def test_hostnameEncoding(self):

    names = []
    hello = u'h\xe1llo.example.com'
    def setupServerContext(ctx):
        def servername_received(conn):
            serverIDNA = _idnaText(conn.get_servername())
            names.append(serverIDNA)
        ctx.set_tlsext_servername_callback(servername_received)
    (cProto, sProto, pump) = self.serviceIdentitySetup(hello, hello, setupServerContext)
    self.assertEqual(names, [hello])
    self.assertEqual(cProto.wrappedProtocol.data, 'greetings!')
    cErr = cProto.wrappedProtocol.lostReason
    sErr = sProto.wrappedProtocol.lostReason
    self.assertIsNone(cErr)
    self.assertIsNone(sErr)
