docs: private void writeHandshake(WebSocketOutputStream output, String key) throws WebSocketException
      {
          // Generate an opening handshake sent to the server from this client.
          mHandshakeBuilder.setKey(key);
          String requestLine     = mHandshakeBuilder.buildRequestLine();
          List<String[]> headers = mHandshakeBuilder.buildHeaders();
          String handshake       = HandshakeBuilder.build(requestLine, headers);
  
          // Call onSendingHandshake() method of listeners.
          mListenerManager.callOnSendingHandshake(requestLine, headers);
  
          try
          {
              // Send the opening handshake to the server.
              output.write(handshake);
              output.flush();
          }
          catch (IOException e)
          {
              // Failed to send an opening handshake request to the server.
              throw new WebSocketException(
                  WebSocketError.OPENING_HAHDSHAKE_REQUEST_FAILURE,
                  "Failed to send an opening handshake request to the server: " + e.getMessage(), e);
          }
      }