#NEWLINE# def test_notifyRemote_cancellation_during_connection( self ) : #NEWLINE# #INDENT# '\n        The Deferred returned by notifyRemote can be cancelled during the\n        connection attempt.\n        ' #NEWLINE# self . assertFalse ( self . endpoint . connected ) #NEWLINE# canceled = [ ] #NEWLINE# self . endpoint . deferred = defer . Deferred ( canceled . append ) #NEWLINE# d = self . factory . notifyRemote ( 'spam' ) #NEWLINE# d . cancel ( ) #NEWLINE# self . assert_ ( canceled ) #NEWLINE# self . assertEqual ( len ( self . flushLoggedErrors ( defer . CancelledError ) ) , 1 ) #NEWLINE# self . failureResultOf ( self , defer . CancelledError )