public LocalIncomingServerSession createIncomingServerSession(Connection conn, StreamID id, String fromDomain)
            throws UnauthorizedException {
        if (serverName == null) {
            throw new UnauthorizedException("Server not initialized");
        }
        LocalIncomingServerSession session = new LocalIncomingServerSession(serverName, conn, id, fromDomain);
        conn.init(session);
        // Register to receive close notification on this session so we can
        // remove its route from the sessions set
        conn.registerCloseListener(incomingServerListener, session);

        return session;
    }
Creates a session for a remote server. The session should be created only after the
remote server has been authenticated either using "server dialback" or SASL.

@param conn the connection to the remote server.
@param id the stream ID used in the stream element when authenticating the server.
@param fromDomain The originating domain
@return the newly created {@link IncomingServerSession}.
@throws UnauthorizedException if the local server has not been initialized yet.
xmppserver/src/main/java/org/jivesoftware/openfire/SessionManager.java