我正在使用Guacamole v0.9.9并尝试连接到已经打开的隧道(必须注意创建新隧道完全按预期工作)。
我有一个扩展GuacamoleHTTPTunnelServlet的servlet并且使用doConnect方法(以及其他一些东西,但这对于这个问题来说无关紧要)。这是骨架代码(业务逻辑被编辑,但我认为不应该改变任何东西):
@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));
}
基本上,查看库初始化代码,似乎行config.setConnectionID(uuid);
足以通过提供的select
uuid
现有隧道,并创建一个连接到它的新隧道。但是,此代码导致错误并且无法连接隧道 - 我得到的错误是504 Gateway Timeout
。
我有什么遗失的吗?我应该以不同方式调用此连接吗?
非常感谢有关实现此功能的任何意见。