public HttpSession createClientHttpSession(StreamID id, HttpConnection connection, Locale language, Duration wait,
                                               int hold, boolean isEncrypted, Duration maxPollingInterval,
                                               int maxRequests, Duration maxPause, Duration defaultInactivityTimeout,
                                               int majorVersion, int minorVersion)
        throws UnauthorizedException, UnknownHostException
    {
        if (serverName == null) {
            throw new UnauthorizedException("Server not initialized");
        }

        final PacketDeliverer backupDeliverer = NettyClientConnectionHandler.BACKUP_PACKET_DELIVERY_ENABLED.getValue() ? new OfflinePacketDeliverer() : null;
        final HttpSession.HttpVirtualConnection vConnection = new HttpSession.HttpVirtualConnection(connection.getRemoteAddr(), backupDeliverer, ConnectionType.SOCKET_C2S);
        final HttpSession session = new HttpSession(vConnection, serverName, id, connection.getRequestId(), connection.getPeerCertificates(), language, wait, hold, isEncrypted,
                                              maxPollingInterval, maxRequests, maxPause, defaultInactivityTimeout, majorVersion, minorVersion);
        vConnection.init(session);
        vConnection.registerCloseListener(clientSessionListener, session);
        localSessionManager.addPreAuthenticatedSession(session);
        connectionsCounter.incrementAndGet();
        return session;
    }
Creates a new {@code ClientSession} with the specified streamID.

@param connection 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 session
@param wait The longest time it is permissible to wait for a response.
@param hold The maximum number of simultaneous waiting requests.
@param isEncrypted True if all connections on this session should be encrypted, and false if they should not.
@param maxPollingInterval The max interval within which a client can send polling requests.
@param maxRequests The max number of requests it is permissible for the session to have open at any one time.
@param maxPause The maximum length of a temporary session pause (in seconds) that the client MAY request.
@param defaultInactivityTimeout The default inactivity timeout of this session.
@param majorVersion the major version of BOSH specification which this session utilizes.
@param minorVersion the minor version of BOSH specification which this session utilizes.
@return a newly created session.
@throws UnauthorizedException if the server has not been initialised
@throws UnknownHostException if no IP address for the peer could be found,
xmppserver/src/main/java/org/jivesoftware/openfire/SessionManager.java