private void sendInstruction(String instruction)
            throws IOException {

        // NOTE: Synchronization on the non-final remote field here is
        // intentional. The remote (the outbound websocket connection) is only
        // sensitive to simultaneous attempts to send messages with respect to
        // itself. If the remote changes, then the outbound websocket
        // connection has changed, and synchronization need only be performed
        // in context of the new remote.
        synchronized (remote) {
            remote.sendText(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-common/src/main/java/org/apache/guacamole/websocket/GuacamoleWebSocketTunnelEndpoint.java