public LocalClientSession createClientSession(Connection conn, StreamID id, Locale language) {
        if (serverName == null) {
            throw new IllegalStateException("Server not initialized");
        }
        LocalClientSession session = new LocalClientSession(serverName, conn, id, language);
        conn.init(session);
        // Register to receive close notification on this session so we can
        // remove  and also send an unavailable presence if it wasn't
        // sent before
        conn.registerCloseListener(clientSessionListener, session);

        // Add to pre-authenticated sessions.
        localSessionManager.addPreAuthenticatedSession(session);
        // Increment the counter of user sessions
        connectionsCounter.incrementAndGet();
        return session;
    }
Creates a new {@code ClientSession} with the specified streamID.

@param conn the connection to create the session from.
@param id the streamID to use for the new session.
@param language The language to use for the new session.
@return a newly created session.
xmppserver/src/main/java/org/jivesoftware/openfire/SessionManager.java