@@ -391,7 +391,7 @@ def test_close_handshake_in_fragmented_text(self):
391391 self .receive_frame (Frame (True , OP_CLOSE , b'' ))
392392 self .receive_eof ()
393393 self .assertIsNone (self .loop .run_until_complete (self .protocol .recv ()))
394- self .assertConnectionClosed (1002 , '' )
394+ self .assertConnectionClosed (1005 , '' )
395395
396396 def test_connection_close_in_fragmented_text (self ):
397397 self .receive_frame (Frame (False , OP_TEXT , 'ca' .encode ('utf-8' )))
@@ -458,20 +458,19 @@ def test_close_handshake_timeout(self):
458458 # response. The server will stop waiting for the close frame and
459459 # timeout.
460460 self .loop .run_until_complete (self .protocol .close (reason = 'close' ))
461- self .assertConnectionClosed (1000 , 'close ' )
461+ self .assertConnectionClosed (1006 , '' )
462462
463463 def test_client_close_race_with_failing_connection (self ):
464464 self .make_drain_slow ()
465465
466466 # Fail the connection while answering a close frame from the client.
467467 self .loop .call_soon (self .receive_frame , self .client_close )
468- fail_connection = self .protocol .fail_connection (1000 , 'server' )
469- self .loop .call_later (MS , self .async , fail_connection )
468+ self .loop .call_later (MS , self .async , self .protocol .fail_connection ())
470469 next_message = self .loop .run_until_complete (self .protocol .recv ())
471470
472471 self .assertIsNone (next_message )
473- # The connection was closed before the close frame could be sent .
474- self .assertConnectionClosed (1006 , '' )
472+ # The closing handshake was completed by fail_connection .
473+ self .assertConnectionClosed (1011 , '' )
475474 self .assertOneFrameSent (* self .client_close )
476475
477476 def test_close_protocol_error (self ):
@@ -581,7 +580,7 @@ def test_close_handshake_timeout(self):
581580 # stop waiting for the close frame and timeout, then stop waiting
582581 # for the connection close and timeout again.
583582 self .loop .run_until_complete (self .protocol .close (reason = 'close' ))
584- self .assertConnectionClosed (1000 , 'close ' )
583+ self .assertConnectionClosed (1006 , '' )
585584
586585 def test_eof_received_timeout (self ):
587586 # Timeout is expected in 10ms.
@@ -600,14 +599,13 @@ def test_server_close_race_with_failing_connection(self):
600599
601600 # Fail the connection while answering a close frame from the server.
602601 self .loop .call_soon (self .receive_frame , self .server_close )
603- fail_connection = self .protocol .fail_connection (1000 , 'client' )
604- self .loop .call_later (MS , self .async , fail_connection )
602+ self .loop .call_later (MS , self .async , self .protocol .fail_connection ())
605603 self .loop .call_later (2 * MS , self .receive_eof )
606604 next_message = self .loop .run_until_complete (self .protocol .recv ())
607605
608606 self .assertIsNone (next_message )
609- # The connection was closed before the close frame could be sent .
610- self .assertConnectionClosed (1006 , '' )
607+ # The closing handshake was completed by fail_connection .
608+ self .assertConnectionClosed (1011 , '' )
611609 self .assertOneFrameSent (* self .server_close )
612610
613611 def test_close_protocol_error (self ):
0 commit comments