@Override
    public Object createWebSocket(UpgradeRequest request, UpgradeResponse response) {

        // Validate and use "guacamole" subprotocol
        for (String subprotocol : request.getSubProtocols()) {

            if ("guacamole".equals(subprotocol)) {
                response.setAcceptedSubProtocol(subprotocol);
                return new RestrictedGuacamoleWebSocketTunnelListener(tunnelRequestService);
            }

        }

        // Invalid protocol
        return null;

    }
Creates a new WebSocketCreator which uses the given TunnelRequestService
to create new GuacamoleTunnels for inbound requests.

@param tunnelRequestService The service to use for inbound tunnel
                            requests.
guacamole/src/main/java/org/apache/guacamole/tunnel/websocket/jetty9/RestrictedGuacamoleWebSocketCreator.java