#NEWLINE# def test_recv_disconnected_too( _socket , conn ) : #NEWLINE# #INDENT# conn . connect ( ) #NEWLINE# assert conn . connected ( ) #NEWLINE# req = MetadataRequest [ 0 ] ( [ ] ) #NEWLINE# header = RequestHeader ( req , client_id = conn . config [ 'client_id' ] ) #NEWLINE# payload_bytes = ( len ( header . encode ( ) ) + len ( req . encode ( ) ) ) #NEWLINE# _socket . send . side_effect = [ 4 , payload_bytes ] #NEWLINE# conn . send ( req ) #NEWLINE# _socket . recv . return_value = b'' #NEWLINE# assert conn . connected ( ) #NEWLINE# conn . recv ( ) #NEWLINE# assert conn . disconnected ( )