def client_and_server( client_options={}, client_patch=lambda x: None, server_options={}, server_patch=lambda x: None, transport_options={}, ): client = QuicConnection( configuration=QuicConfiguration(is_client=True, **client_options)) client._ack_delay = 0 client_patch(client) server = QuicConnection( configuration=QuicConfiguration(is_client=False, certificate=SERVER_CERTIFICATE, private_key=SERVER_PRIVATE_KEY, **server_options)) server._ack_delay = 0 server_patch(server) # perform handshake client.connect(SERVER_ADDR, now=time.time()) for i in range(3): roundtrip(client, server) yield client, server # close client.close() server.close()
def create_standalone_client(self): client = QuicConnection(configuration=QuicConfiguration(is_client=True)) client._ack_delay = 0 # kick-off handshake client.connect(SERVER_ADDR, now=time.time()) self.assertEqual(drop(client), 1) return client