'If the length of the response body is unknown, the protocol passed to
the response\'s C{deliverBody} method has its C{connectionLost}
method called with a L{Failure} wrapping a L{PotentialDataLoss}
exception.'

def test_responseBodyFinishedWhenConnectionLostWhenContentLengthIsUnknown(self):

    requestDeferred = self.protocol.request(Request('GET', '/', _boringHeaders, None))
    self.protocol.dataReceived('HTTP/1.1    200    OK\r\n\r\n')
    result = []
    requestDeferred.addCallback(result.append)
    response = result[0]
    protocol = AccumulatingProtocol()
    response.deliverBody(protocol)
    self.protocol.dataReceived('foo')
    self.protocol.dataReceived('bar')
    self.assertEqual(protocol.data, 'foobar')
    self.protocol.connectionLost(Failure(ConnectionDone(u'low-level    transport    disconnected')))
    protocol.closedReason.trap(PotentialDataLoss)
