def test_abortAfterResponseHeaders(self):
        transport = StringTransport()
        protocol = HTTP11ClientProtocol()
        protocol.makeConnection(transport)
        result = protocol.request(Request('GET', '/', _boringHeaders, None))

        protocol.dataReceived(
            "HTTP/1.1 200 OK\r\n"
            "Content-Length: 1\r\n"
            "\r\n"
            )

        testResult = Deferred()

        class BodyDestination(Protocol):
            """
            A body response protocol which immediately aborts the HTTP
            connection.
            """
            def connectionMade(self):
                """
                Abort the HTTP connection.
                """
                protocol.abort()

            def connectionLost(self, reason):
                """
                Make the reason for the losing of the connection available to
                the unit test via C{testResult}.
                """
                testResult.errback(reason)


        def deliverBody(response):
            """
            Connect the L{BodyDestination} response body protocol to the
            response, and then simulate connection loss after ensuring that
            the HTTP connection has been aborted.
            """
            response.deliverBody(BodyDestination())
            self.assertTrue(transport.disconnecting)
            protocol.connectionLost(Failure(ConnectionDone()))

        result.addCallback(deliverBody)
        return assertResponseFailed(self, testResult,
                                    [ConnectionAborted, _DataLoss])
When the connection is aborted after the response headers have
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/web/test/test_newclient.py/HTTP11ClientProtocolTests.test_abortAfterResponseHeaders