def test_failure(self):
"""
If no address is returned by GAI for a hostname, the connection attempt
fails with L{error.DNSLookupError}.
"""
endpoint = endpoints.HostnameEndpoint(
deterministicResolvingReactor(Clock(), []),
b"example.com", 80
)
clientFactory = object()
dConnect = endpoint.connect(clientFactory)
exc = self.failureResultOf(dConnect, error.DNSLookupError)
self.assertIn("example.com", str(exc))
评论列表
文章目录