diff --git a/guacamole-common/src/main/java/org/glyptodon/guacamole/protocol/ConfiguredGuacamoleSocket.java b/guacamole-common/src/main/java/org/glyptodon/guacamole/protocol/ConfiguredGuacamoleSocket.java index 094527801..5856b6cd3 100644 --- a/guacamole-common/src/main/java/org/glyptodon/guacamole/protocol/ConfiguredGuacamoleSocket.java +++ b/guacamole-common/src/main/java/org/glyptodon/guacamole/protocol/ConfiguredGuacamoleSocket.java @@ -129,8 +129,13 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket { GuacamoleReader reader = socket.getReader(); GuacamoleWriter writer = socket.getWriter(); - // Send protocol - writer.writeInstruction(new GuacamoleInstruction("select", config.getProtocol())); + // Get protocol / connection ID + String select_arg = config.getConnectionID(); + if (select_arg == null) + select_arg = config.getProtocol(); + + // Send requested protocol or connection ID + writer.writeInstruction(new GuacamoleInstruction("select", select_arg)); // Wait for server args GuacamoleInstruction args = expect(reader, "args"); diff --git a/guacamole-common/src/main/java/org/glyptodon/guacamole/protocol/GuacamoleConfiguration.java b/guacamole-common/src/main/java/org/glyptodon/guacamole/protocol/GuacamoleConfiguration.java index 714bbc6c0..6140f9fc5 100644 --- a/guacamole-common/src/main/java/org/glyptodon/guacamole/protocol/GuacamoleConfiguration.java +++ b/guacamole-common/src/main/java/org/glyptodon/guacamole/protocol/GuacamoleConfiguration.java @@ -42,6 +42,12 @@ public class GuacamoleConfiguration implements Serializable { */ private static final long serialVersionUID = 1L; + /** + * The ID of the connection being joined. If this value is present, + * the protocol need not be specified. + */ + private String connectionID; + /** * The name of the protocol associated with this configuration. */ @@ -52,6 +58,28 @@ public class GuacamoleConfiguration implements Serializable { */ private Map parameters = new HashMap(); + /** + * Returns the ID of the connection being joined, if any. If no connection + * is being joined, this returns null, and the protocol must be set. + * + * @return The ID of the connection being joined, or null if no connection + * is being joined. + */ + public String getConnectionID() { + return connectionID; + } + + /** + * Sets the ID of the connection being joined, if any. If no connection + * is being joined, this value must be omitted, and the protocol must be + * set instead. + * + * @param connectionID The ID of the connection being joined. + */ + public void setConnectionID(String connectionID) { + this.connectionID = connectionID; + } + /** * Returns the name of the protocol to be used. * @return The name of the protocol to be used.