'If the final chunk has not been received when the connection is lost
(for any reason), the protocol passed to C{deliverBody} has its
C{connectionLost} method called with a L{Failure} wrapping the
exception for that reason.'

def test_chunkedResponseBodyUnfinishedWhenConnectionLost(self):

    requestDeferred = self.protocol.request(Request('GET', '/', _boringHeaders, None))
    self.protocol.dataReceived('HTTP/1.1    200    OK\r\nTransfer-Encoding:    chunked\r\n\r\n')
    result = []
    requestDeferred.addCallback(result.append)
    response = result[0]
    protocol = AccumulatingProtocol()
    response.deliverBody(protocol)
    self.protocol.dataReceived('3\r\nfoo\r\n')
    self.protocol.dataReceived('3\r\nbar\r\n')
    self.assertEqual(protocol.data, 'foobar')
    self.protocol.connectionLost(Failure(ArbitraryException()))
    return assertResponseFailed(self, fail(protocol.closedReason), [ArbitraryException, _DataLoss])
