public boolean createClientSession(String connectionManagerDomain, StreamID streamID, String hostName, String hostAddress) {
        Connection connection = new ClientSessionConnection(connectionManagerDomain, hostName, hostAddress);
        // Check if client is allowed to connect from the specified IP address. Ignore the checking if connection
        // manager is old version and is not passing client's address
        byte[] address = null;
        try {
            address = connection.getAddress();
        } catch (UnknownHostException e) {
            // Ignore
        }
        if (address == null || LocalClientSession.isAllowed(connection)) {
            LocalClientSession session =
                    SessionManager.getInstance().createClientSession(connection, streamID);
            // Register that this streamID belongs to the specified connection manager
            streamIDs.put(streamID, connectionManagerDomain);
            // Register which sessions are being hosted by the specified connection manager
            ConcurrentMap<StreamID, LocalClientSession> sessions = sessionsByManager.computeIfAbsent(connectionManagerDomain, c -> new ConcurrentHashMap<>());
            sessions.put(streamID, session);
            return true;
        }
        return false;
    }
Creates a new client session that was established to the specified connection manager.
The new session will not be findable through its stream ID.

@param connectionManagerDomain the connection manager that is handling the connection
       of the session.
@param streamID the stream ID created by the connection manager for the new session.
@param hostName the address's hostname of the client or null if using old connection manager.
@param hostAddress the textual representation of the address of the client or null if using old CM.
@return true if a session was created or false if the client should disconnect.
xmppserver/src/main/java/org/jivesoftware/openfire/multiplex/ConnectionMultiplexerManager.java