@Override
                    public GuacamoleInstruction filter(GuacamoleInstruction instruction)
                            throws GuacamoleException {

                        // Filter out all tunnel-internal instructions
                        if (instruction.getOpcode().equals(GuacamoleTunnel.INTERNAL_DATA_OPCODE)) {

                            // Respond to ping requests
                            List<String> args = instruction.getArgs();
                            if (args.size() >= 2 && args.get(0).equals(PING_OPCODE)) {

                                try {
                                    sendInstruction(new GuacamoleInstruction(
                                        GuacamoleTunnel.INTERNAL_DATA_OPCODE,
                                        PING_OPCODE, args.get(1)
                                    ));
                                }
                                catch (IOException e) {
                                    logger.debug("Unable to send \"ping\" response for WebSocket tunnel.", e);
                                }

                            }

                            return null;

                        }

                        // Pass through all non-internal instructions untouched
                        return instruction;

                    }
Sends a Guacamole instruction along the outbound WebSocket
connection to the connected Guacamole client. If an instruction
is already in the process of being sent by another thread, this
function will block until in-progress instructions are complete.

@param instruction
    The instruction to send.

@throws IOException
    If an I/O error occurs preventing the given instruction from being
    sent.
guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/tomcat/GuacamoleWebSocketTunnelServlet.java