#NEWLINE# def test_subscribeTwiceGetNotification( self ) : #NEWLINE# #INDENT# def onNotification1( data , headers ) : #NEWLINE# #INDENT# d = client1 . stopService ( ) #NEWLINE# d . chainDeferred ( client1 . deferred ) #NEWLINE# #UNINDENT# def onNotification2( data , headers ) : #NEWLINE# #INDENT# d = client2 . stopService ( ) #NEWLINE# d . chainDeferred ( client2 . deferred ) #NEWLINE# #UNINDENT# def cb( response ) : #NEWLINE# #INDENT# xmppURI = response [ 'uri' ] #NEWLINE# d = client1 . subscribe ( xmppURI ) #NEWLINE# d . addCallback ( ( lambda _ : xmppURI ) ) #NEWLINE# return d #NEWLINE# #UNINDENT# def cb2( xmppURI ) : #NEWLINE# #INDENT# d = client2 . subscribe ( xmppURI ) #NEWLINE# d . addCallback ( ( lambda _ : xmppURI ) ) #NEWLINE# return d #NEWLINE# #UNINDENT# def cb3( xmppURI ) : #NEWLINE# #INDENT# d = self . client . publish ( TEST_ENTRY , xmppURI ) #NEWLINE# return d #NEWLINE# #UNINDENT# client1 = gateway . GatewayClient ( baseURI , callbackPort = 8088 ) #NEWLINE# client1 . startService ( ) #NEWLINE# client1 . callback = onNotification1 #NEWLINE# client1 . deferred = defer . Deferred ( ) #NEWLINE# client2 = gateway . GatewayClient ( baseURI , callbackPort = 8089 ) #NEWLINE# client2 . startService ( ) #NEWLINE# client2 . callback = onNotification2 #NEWLINE# client2 . deferred = defer . Deferred ( ) #NEWLINE# d = self . client . create ( ) #NEWLINE# d . addCallback ( cb ) #NEWLINE# d . addCallback ( cb2 ) #NEWLINE# d . addCallback ( cb3 ) #NEWLINE# dl = defer . gatherResults ( [ d , client1 . deferred , client2 . deferred ] ) #NEWLINE# return dl