// Path: src/main/java/org/webbitserver/WebSocketConnection.java
// public interface WebSocketConnection extends HttpConnection {
// 
//     /**
//      * Sends a text frame
//      *
//      * @param message frame payload
//      * @return this
//      */
//     WebSocketConnection send(String message);
// 
//     /**
//      * Sends a binary frame
//      *
//      * @param message frame payload
//      * @return this
//      */
//     WebSocketConnection send(byte[] message);
// 
//     /**
//      * Sends a binary frame
//      *
//      * @param message frame payload
//      * @param offset  The offset within the array of the first byte to be written; must be non-negative and no larger than <code>message.length</code>
//      * @param length  The maximum number of bytes to be written to the given array; must be non-negative and no larger than <code>message.length - offset</code>
//      * @return this
//      */
//     WebSocketConnection send(byte[] message, int offset, int length);
// 
//     /**
//      * Sends a ping frame
//      *
//      * @param message the payload of the ping
//      * @return this
//      */
//     WebSocketConnection ping(byte[] message);
// 
//     /**
//      * Sends a pong frame
//      *
//      * @param message the payload of the ping
//      * @return this
//      */
//     WebSocketConnection pong(byte[] message);
// 
//     /**
//      * @return the WebSocket protocol version
//      */
//     String version();
// 
//     // Override methods to provide more specific return type.
// 
//     @Override
//     WebSocketConnection close();
// 
//     @Override
//     WebSocketConnection data(String key, Object value);
// }
// 
// Path: src/main/java/org/webbitserver/WebSocketHandler.java
// public interface WebSocketHandler {
//     void onOpen(WebSocketConnection connection) throws Throwable;
// 
//     /**
//      * Called when a connection is closed.
//      *
//      * @param connection the connection that was closed. Beware that the connection will be null if this handler is used in a {@link WebSocket} that fails to connect.
//      * @throws Exception
//      */
//     void onClose(WebSocketConnection connection) throws Throwable;
// 
//     void onMessage(WebSocketConnection connection, String msg) throws Throwable;
// 
//     void onMessage(WebSocketConnection connection, byte[] msg) throws Throwable;
// 
//     void onPing(WebSocketConnection connection, byte[] msg) throws Throwable;
// 
//     void onPong(WebSocketConnection connection, byte[] msg) throws Throwable;
// }


import org.webbitserver.WebSocketConnection;
import org.webbitserver.WebSocketHandler;
        this.handler = handler;
    }

    @Override
    public void onOpen(WebSocketConnection connection) throws Throwable {
        logSink.webSocketConnectionOpen(connection);
        handler.onOpen(loggingConnection);
    }

    @Override
    public void onClose(WebSocketConnection connection) throws Throwable {
        logSink.webSocketConnectionClose(connection);
        logSink.httpEnd(connection.httpRequest());
        handler.onClose(loggingConnection);
    }

    @Override
    public void onMessage(WebSocketConnection connection, String message) throws Throwable {
        logSink.webSocketInboundData(connection, message);
        handler.onMessage(loggingConnection, message);
    }

    @Override
    public void onMessage(WebSocketConnection connection, byte[] message) throws Throwable {
        logSink.webSocketInboundData(connection, message);
        handler.onMessage(loggingConnection, message);
    }

    @Override
    public void onPing(WebSocketConnection connection, byte[] message) throws Throwable {
// Path: src/main/java/org/webbitserver/WebSocketConnection.java
// public interface WebSocketConnection extends HttpConnection {
// 
//     /**
//      * Sends a text frame
//      *
//      * @param message frame payload
//      * @return this
//      */
//     WebSocketConnection send(String message);
// 
//     /**
//      * Sends a binary frame
//      *
//      * @param message frame payload
//      * @return this
//      */
//     WebSocketConnection send(byte[] message);
// 
//     /**
//      * Sends a binary frame
//      *
//      * @param message frame payload
//      * @param offset  The offset within the array of the first byte to be written; must be non-negative and no larger than <code>message.length</code>
//      * @param length  The maximum number of bytes to be written to the given array; must be non-negative and no larger than <code>message.length - offset</code>
//      * @return this
//      */
//     WebSocketConnection send(byte[] message, int offset, int length);
// 
//     /**
//      * Sends a ping frame
//      *
//      * @param message the payload of the ping
//      * @return this
//      */
//     WebSocketConnection ping(byte[] message);
// 
//     /**
//      * Sends a pong frame
//      *
//      * @param message the payload of the ping
//      * @return this
//      */
//     WebSocketConnection pong(byte[] message);
// 
//     /**
//      * @return the WebSocket protocol version
//      */
//     String version();
// 
//     // Override methods to provide more specific return type.
// 
//     @Override
//     WebSocketConnection close();
// 
//     @Override
//     WebSocketConnection data(String key, Object value);
// }
// 
// Path: src/main/java/org/webbitserver/WebSocketHandler.java
// public interface WebSocketHandler {
//     void onOpen(WebSocketConnection connection) throws Throwable;
// 
//     /**
//      * Called when a connection is closed.
//      *
//      * @param connection the connection that was closed. Beware that the connection will be null if this handler is used in a {@link WebSocket} that fails to connect.
//      * @throws Exception
//      */
//     void onClose(WebSocketConnection connection) throws Throwable;
// 
//     void onMessage(WebSocketConnection connection, String msg) throws Throwable;
// 
//     void onMessage(WebSocketConnection connection, byte[] msg) throws Throwable;
// 
//     void onPing(WebSocketConnection connection, byte[] msg) throws Throwable;
// 
//     void onPong(WebSocketConnection connection, byte[] msg) throws Throwable;
// }


// Path: src/main/java/org/webbitserver/handler/logging/LoggingWebSocketHandler.java
import org.webbitserver.WebSocketConnection;
import org.webbitserver.WebSocketHandler;

        this.handler = handler;
    }

    @Override
    public void onOpen(WebSocketConnection connection) throws Throwable {
        logSink.webSocketConnectionOpen(connection);
        handler.onOpen(loggingConnection);
    }

    @Override
    public void onClose(WebSocketConnection connection) throws Throwable {
        logSink.webSocketConnectionClose(connection);
        logSink.httpEnd(connection.httpRequest());
        handler.onClose(loggingConnection);
    }

    @Override
    public void onMessage(WebSocketConnection connection, String message) throws Throwable {
        logSink.webSocketInboundData(connection, message);
        handler.onMessage(loggingConnection, message);
    }

    @Override
    public void onMessage(WebSocketConnection connection, byte[] message) throws Throwable {
        logSink.webSocketInboundData(connection, message);
        handler.onMessage(loggingConnection, message);
    }

    @Override
    public void onPing(WebSocketConnection connection, byte[] message) throws Throwable {
        logSink.webSocketInboundPing(connection, message);