def METHOD_NAME(self) -> None:
    """Creates a key and sends websocket handshake packet to upstream.
    Receives response from the server and asserts that websocket
    accept header is valid in the response."""
    key = base64.b64encode(secrets.token_bytes(16))
    self.sock.send(
        build_websocket_handshake_request(
            key,
            url=self.path,
            host=self.hostname,
        ),
    )
    response = HttpParser(httpParserTypes.RESPONSE_PARSER)
    response.parse(memoryview(self.sock.recv(DEFAULT_BUFFER_SIZE)))
    accept = response.header(b'Sec-Websocket-Accept')
    assert WebsocketFrame.key_to_accept(key) == accept