1

I am using Guacamole v0.9.9 and trying to connect to an already open tunnel (must note that creating new tunnels works completely as expected).

I have a servlet extending GuacamoleHTTPTunnelServlet and ovverriding the doConnect method (and a bunch of other things, but that's irrelevant for the sake of this question). Here is the skeletal code (the business logic was redacted, but shouldn't change anything, I think):

@Override
protected GuacamoleTunnel doConnect(HttpServletRequest request) throws GuacamoleException {

    GuacamoleSocket guacamoleSocket = null;
    GuacamoleTunnelInformation guacamoleTunnelInformation = null;

    GuacamoleConfiguration config = new GuacamoleConfiguration();

    // bunch of common parameteres set on config (like font-size, cursor, etc.)

    GuacamoleClientInformation info = new GuacamoleClientInformation();
    info.setOptimalScreenHeight(630);
    info.setOptimalScreenWidth(1200);

    // This parameter will be supplied in case of connection to existing tunnel
    String uuid = request.getParameter("uuid");

    if (uuid != null && !"".equals(uuid)) {

        guacamoleSocket = new InetGuacamoleSocket("localhost", 4822);   // guacamole daemon listens on port 4822

        config.setConnectionID(uuid);

        // bunch of additional parameters set on config to resemble already connected tunnel

    } else {

        guacamoleSocket = new InetGuacamoleSocket("localhost", 4822);

        // bunch of additional parameters set on config (like host, port, type, etc.)
    }

    // Return a new tunnel which uses the connected socket
    return new SimpleGuacamoleTunnel(new ConfiguredGuacamoleSocket(guacamoleSocket, config, info));
}

Essentially, looking through the library initialization code, it seems that the line config.setConnectionID(uuid); is enough to select the existing tunnel via supplied uuid and create a new one connecting to it. However, this code results in an error and the tunnel cannot be connected to - the error I get is 504 Gateway Timeout.

Is there something I am missing? Should I invoke this connection differently?

Would appreciate any input on achieving this functionality.

st2rseeker
  • 473
  • 1
  • 5
  • 28

0 Answers0