@Override
    @Transactional
    public GuacamoleTunnel getGuacamoleTunnel(RemoteAuthenticatedUser user,
            SharedConnectionDefinition definition,
            GuacamoleClientInformation info, Map<String, String> tokens)
            throws GuacamoleException {

        // Create a connection record which describes the shared connection
        ActiveConnectionRecord connectionRecord = new ActiveConnectionRecord(connectionMap,
                user, definition.getActiveConnection(), definition.getSharingProfile());

        // Connect to shared connection described by the created record
        GuacamoleTunnel tunnel = assignGuacamoleTunnel(connectionRecord, info, tokens, false);

        // Register tunnel, such that it is closed when the
        // SharedConnectionDefinition is invalidated
        definition.registerTunnel(tunnel);
        return tunnel;

    }
Returns a list of all balanced connections within a given connection
group. If the connection group is not balancing, or it contains no
connections, an empty list is returned.

@param user
    The user on whose behalf the balanced connections within the given
    connection group are being retrieved.

@param connectionGroup
    The connection group to retrieve the balanced connections of.

@return
    A list containing all balanced connections within the given group,
    or an empty list if there are no such connections.
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java