#NEWLINE# def test_failedWriteTo( self ) : #NEWLINE# #INDENT# '\n        If the L{Deferred} returned by L{Request.writeTo} fires with a\n        L{Failure}, L{HTTP11ClientProtocol.request} disconnects its transport\n        and returns a L{Deferred} which fires with a L{Failure} of\n        L{RequestGenerationFailed} wrapping the underlying failure.\n        ' #NEWLINE# class BrokenRequest ( ) : #NEWLINE# #INDENT# persistent = False #NEWLINE# def writeTo( self , transport ) : #NEWLINE# #INDENT# return fail ( ArbitraryException ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# d = self . protocol . request ( BrokenRequest ( ) ) #NEWLINE# def cbFailed( ignored ) : #NEWLINE# #INDENT# self . assertTrue ( self . transport . disconnecting ) #NEWLINE# self . protocol . connectionLost ( Failure ( ConnectionDone ( 'you asked for it' ) ) ) #NEWLINE# #UNINDENT# d = assertRequestGenerationFailed ( self , d , [ ArbitraryException ] ) #NEWLINE# d . addCallback ( cbFailed ) #NEWLINE# return cbFailed