def test_handle_reset_stream_frame_send_only(self): client = QuicConnection(is_client=True) server = QuicConnection( is_client=False, certificate=SERVER_CERTIFICATE, private_key=SERVER_PRIVATE_KEY, ) # perform handshake client_transport, server_transport = create_transport(client, server) # client creates unidirectional stream 2 client.create_stream(is_unidirectional=True) # client receives RESET_STREAM with self.assertRaises(QuicConnectionError) as cm: client._handle_reset_stream_frame( tls.Epoch.ONE_RTT, QuicFrameType.RESET_STREAM, Buffer(data=binascii.unhexlify("021122000001")), ) self.assertEqual(cm.exception.error_code, QuicErrorCode.STREAM_STATE_ERROR) self.assertEqual(cm.exception.frame_type, QuicFrameType.RESET_STREAM) self.assertEqual(cm.exception.reason_phrase, "Stream is send-only")
def test_handle_reset_stream_frame(self): client = QuicConnection(is_client=True) server = QuicConnection( is_client=False, certificate=SERVER_CERTIFICATE, private_key=SERVER_PRIVATE_KEY, ) # perform handshake client_transport, server_transport = create_transport(client, server) # client creates bidirectional stream 0 client.create_stream() # client receives RESET_STREAM client._handle_reset_stream_frame( tls.Epoch.ONE_RTT, QuicFrameType.RESET_STREAM, Buffer(data=binascii.unhexlify("001122000001")), )