private WebSocketOutputStream openOutputStream(Socket socket) throws WebSocketException {
  try {
    return new WebSocketOutputStream(new BufferedOutputStream(socket.getOutputStream()));
  }
 catch (  IOException e) {
    throw new WebSocketException(WebSocketError.SOCKET_OUTPUT_STREAM_FAILURE,"Failed to get the output stream from the raw socket: " + e.getMessage(),e);
  }
}

private WebSocketOutputStream openOutputStream ( Socket socket ) throws WebSocketException { try { return new WebSocketOutputStream ( new BufferedOutputStream ( socket . getOutputStream ( ) ) ) ; } catch ( IOException e ) { throw new WebSocketException ( WebSocketError . SOCKET_OUTPUT_STREAM_FAILURE , "Failed to get the output stream from the raw socket: " + e . getMessage ( ) , e ) ; } }
open the output stream of the websocket connection . the stream is used by the writing thread .
