@Path("connection")
    public DirectoryObjectResource<Connection, APIConnection> getConnection()
            throws GuacamoleException {

        UserContext userContext = getUserContext();
        ActiveConnection activeConnection = getInternalObject();
        
        // Return the underlying connection as a resource
        return connectionDirectoryResourceFactory
                .create(getAuthenticatedUser(), userContext, userContext.getConnectionDirectory())
                .getObjectResource(activeConnection.getConnectionIdentifier());

    }
Retrieves a resource representing the Connection object that is being
actively used.

@return
    A resource representing the Connection object that is being actively
    used.

@throws GuacamoleException
    If an error occurs while retrieving the Connection.
guacamole/src/main/java/org/apache/guacamole/rest/activeconnection/ActiveConnectionResource.java