#NEWLINE# def test_close_callback_with_pending_read( self ) : #NEWLINE# #INDENT# OK = b'OK\r\n' #NEWLINE# ( server , client ) = self . make_iostream_pair ( ) #NEWLINE# client . set_close_callback ( self . stop ) #NEWLINE# try : #NEWLINE# #INDENT# server . write ( client ) #NEWLINE# client . read_until ( b'\r\n' , self . stop ) #NEWLINE# res = self . wait ( ) #NEWLINE# self . assertEqual ( res , OK ) #NEWLINE# server . close ( ) #NEWLINE# client . read_until ( b'\r\n' , ( lambda x : x ) ) #NEWLINE# res = self . wait ( ) #NEWLINE# self . assertTrue ( ( res is None ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# server . close ( ) #NEWLINE# client . close ( )