#NEWLINE# def test_finishedWithErrorWhenConnected( self ) : #NEWLINE# #INDENT# "\n        The L{Failure} passed to L{Response._bodyDataFinished} when the response\n        is in the I{connected} state is passed to the C{connectionLost} method\n        of the L{IProtocol} provider passed to the L{Response}'s\n        C{deliverBody} method.\n        " #NEWLINE# transport = StringTransport ( ) #NEWLINE# response = justTransportResponse ( transport ) #NEWLINE# protocol = AccumulatingProtocol ( ) #NEWLINE# response . deliverBody ( response ) #NEWLINE# self . assertEqual ( response . _state , 'CONNECTED' ) #NEWLINE# response . _bodyDataFinished ( Failure ( ArbitraryException ( ) ) ) #NEWLINE# protocol . closedReason . trap ( ArbitraryException )