private static String createSessionCreationResponse(HttpSession session) throws DocumentException {
        Element response = DocumentHelper.createElement( QName.get( "body", "http://jabber.org/protocol/httpbind" ) );
        response.addNamespace("stream", "http://etherx.jabber.org/streams");
        response.addAttribute("from", session.getServerName());
        response.addAttribute("authid", session.getStreamID().getID());
        response.addAttribute("sid", session.getStreamID().getID());
        response.addAttribute("secure", Boolean.TRUE.toString());
        response.addAttribute("requests", String.valueOf(session.getMaxRequests()));
        response.addAttribute("inactivity", String.valueOf(session.getInactivityTimeout().toSeconds()));
        response.addAttribute("polling", String.valueOf(session.getMaxPollingInterval().toSeconds()));
        response.addAttribute("wait", String.valueOf(session.getWait().getSeconds()));
        if ((session.getMajorVersion() == 1 && session.getMinorVersion() >= 6) ||
            session.getMajorVersion() > 1) {
            response.addAttribute("hold", String.valueOf(session.getHold()));
            response.addAttribute("ack", String.valueOf(session.getLastAcknowledged()));
            response.addAttribute("maxpause", String.valueOf(session.getMaxPause().toSeconds()));
            response.addAttribute("ver", session.getMajorVersion() + "." + session.getMinorVersion());
        }

        Element features = response.addElement("stream:features");
        for (Element feature : session.getAvailableStreamFeatures()) {
            features.add(feature);
        }

        return response.asXML();
    }
Period of time a polling session has to be idle to be closed. Default is 60 seconds. Sending stanzas to the
client is not considered as activity. We are only considering the connection active when the
client sends some data or heartbeats (i.e. whitespaces) to the server. The reason for this is
that sending data will fail if the connection is closed. And if the thread is blocked while
sending data (because the socket is closed) then the clean up thread will close the socket
anyway.
xmppserver/src/main/java/org/jivesoftware/openfire/http/HttpSessionManager.java