//WebSocket with overloaded getOutputStream and getInputStream methods
//those return custom streams, that provide the WebSocket frame creation/parsing
public WebSocket accept() throws IOException, WebSocketException {
socket = new WebSocket(serverSock.accept()) {
private OutputStream outputStream = new ServersideWebSocketOutputStream(socket);
private InputStream inputStream = new ServersideWebSocketInputStream(socket);
@Override
public OutputStream getOutputStream() throws IOException {
return outputStream;
}