def test_utf8Encoding(self):
"""
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}.
"""
reactor = object()
endpoint = endpoints.clientFromString(
reactor, b'tls:\xc3\xa9xample.example.com:443'
)
self.assertEqual(
endpoint._wrappedEndpoint._hostBytes,
b'xn--xample-9ua.example.com'
)
connectionCreator = connectionCreatorFromEndpoint(
reactor, endpoint)
self.assertEqual(connectionCreator._hostname,
u'\xe9xample.example.com')
评论列表
文章目录