#NEWLINE# def test_request_multiplexing( self ) : #NEWLINE# #INDENT# req_id = next_req_id ( ) #NEWLINE# req_id_2 = next_req_id ( ) #NEWLINE# req_id_3 = next_req_id ( ) #NEWLINE# role = FCGI_RESPONDER #NEWLINE# flags = 0 #NEWLINE# records = ( ( FCGI_BEGIN_REQUEST , pack_begin_request ( role , flags ) , req_id ) , ( FCGI_PARAMS , pack_env ( ) , req_id ) , ( FCGI_BEGIN_REQUEST , pack_begin_request ( role , flags ) , req_id_2 ) , ( FCGI_BEGIN_REQUEST , pack_begin_request ( role , flags ) , req_id_3 ) , ( FCGI_PARAMS , pack_env ( ) , req_id_3 ) , ( FCGI_PARAMS , pack_env ( ) , req_id_2 ) , ( FCGI_PARAMS , '' , req_id_2 ) , ( FCGI_PARAMS , '' , req_id ) , ( FCGI_ABORT_REQUEST , '' , req_id_3 ) ) #NEWLINE# handler = run_handler ( records , role = role ) #NEWLINE# assert ( not handler . requests ) #NEWLINE# assert ( handler . request_handler . call_count == 2 ) #NEWLINE# assert handler . conn . close . called #NEWLINE# for r_id in ( req_id , req_id_2 , req_id_3 ) : #NEWLINE# #INDENT# rec = find_rec ( handler , FCGI_END_REQUEST , r_id ) #NEWLINE# assert ( rec and unpack_end_request ( rec . content ) ) #NEWLINE# for stream in ( FCGI_STDOUT , FCGI_STDERR ) : #NEWLINE# #INDENT# assert ( '' == read_stream ( handler , stream , r_id ) )