private void closeConnection(WsOutbound outbound, int guacamoleStatusCode,
            int webSocketCode) {

        try {
            byte[] message = Integer.toString(guacamoleStatusCode).getBytes("UTF-8");
            outbound.close(webSocketCode, ByteBuffer.wrap(message));
        }
        catch (IOException e) {
            logger.debug("Unable to close WebSocket tunnel.", e);
        }

    }
Sends the given Guacamole and WebSocket numeric status
on the given WebSocket connection and closes the
connection.

@param outbound
    The outbound WebSocket connection to close.

@param guacamoleStatusCode
    The status to send.

@param webSocketCode
    The numeric WebSocket status code to send.
guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/GuacamoleWebSocketTunnelServlet.java