def test_connectionFailed(self):
        request = DummyRequest(['foo'])
        factory = ProxyClientFactory('GET', '/foo', 'HTTP/1.0',
                                     {"accept": "text/html"}, '', request)

        factory.clientConnectionFailed(None, None)
        self.assertEquals(request.responseCode, 501)
        self.assertEquals(request.responseMessage, "Gateway error")
        self.assertEquals(
            list(request.responseHeaders.getAllRawHeaders()),
            [("Content-Type", ["text/html"])])
        self.assertEquals(
            ''.join(request.written),
            "<H1>Could not connect</H1>")
        self.assertEquals(request.finished, 1)
Check that L{ProxyClientFactory.clientConnectionFailed} produces
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/web/test/test_proxy.py/ProxyClientFactoryTestCase.test_connectionFailed