#NEWLINE# def test_delayed_close_callback( self ) : #NEWLINE# #INDENT# ( server , client ) = self . make_iostream_pair ( ) #NEWLINE# try : #NEWLINE# #INDENT# client . set_close_callback ( self . stop ) #NEWLINE# server . write ( b'12' ) #NEWLINE# chunks = [ ] #NEWLINE# def callback1( data ) : #NEWLINE# #INDENT# chunks . append ( data ) #NEWLINE# client . read_bytes ( 1 , callback2 ) #NEWLINE# server . close ( ) #NEWLINE# #UNINDENT# def callback2( data ) : #NEWLINE# #INDENT# chunks . append ( data ) #NEWLINE# #UNINDENT# client . read_bytes ( 1 , callback1 ) #NEWLINE# self . wait ( ) #NEWLINE# self . assertEqual ( chunks , [ b'1' , b'2' ] ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# server . close ( ) #NEWLINE# client . close ( )