'The hostname passed to L{clientFromString} is treated as utf-8 bytes;
it is then encoded as IDNA when it is passed along to
L{HostnameEndpoint}, and passed as unicode to L{optionsForClientTLS}.'

def test_utf8Encoding(self):

    reactor = object()
    endpoint = endpoints.clientFromString(reactor, 'tls:\xc3\xa9xample.example.com:443')
    self.assertEqual(endpoint._wrappedEndpoint._hostBytes, 'xn--xample-9ua.example.com')
    connectionCreator = connectionCreatorFromEndpoint(reactor, endpoint)
    self.assertEqual(connectionCreator._hostname, u'\xe9xample.example.com')
