protected void tlsNegotiated(XmlPullParser xpp) throws XmlPullParserException, IOException {
        final Document document = getStreamHeader();

        // Offer stream features including SASL Mechanisms
        final Element features = DocumentHelper.createElement(QName.get("features", "stream", "http://etherx.jabber.org/streams"));
        document.getRootElement().add(features);

        // Include available SASL Mechanisms
        final Element mechanismsElement=SASLAuthentication.getSASLMechanisms(session);
        if (mechanismsElement!=null) {
        	features.add(mechanismsElement);
        }

        // Include specific features such as auth and register for client sessions
        final List<Element> specificFeatures = session.getAvailableStreamFeatures();
        if (specificFeatures != null) {
            for (final Element feature : specificFeatures) {
                features.add(feature);
            }
        }

        connection.deliverRawText(StringUtils.asUnclosedStream(document));
    }
TLS negotiation was successful so open a new stream and offer the new stream features.
The new stream features will include available SASL mechanisms and specific features
depending on the session type such as auth for Non-SASL authentication and register
for in-band registration.
xmppserver/src/main/java/org/jivesoftware/openfire/net/StanzaHandler.java