'The L{Failure} passed to L{Response._bodyDataFinished} when the response
is in the I{connected} state is passed to the C{connectionLost} method
of the L{IProtocol} provider passed to the L{Response}\'s
C{deliverBody} method.'

def test_finishedWithErrorWhenConnected(self):

    transport = StringTransport()
    response = justTransportResponse(transport)
    protocol = AccumulatingProtocol()
    response.deliverBody(protocol)
    self.assertEqual(response._state, u'CONNECTED')
    response._bodyDataFinished(Failure(ArbitraryException()))
    protocol.closedReason.trap(ArbitraryException)
