protected void tlsNegotiated() 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"));
        final Element mechanisms = SASLAuthentication.getSASLMechanisms(socketReader.session);
        if (mechanisms != null) {
            features.add(mechanisms);
        }
        final List<Element> specificFeatures = socketReader.session.getAvailableStreamFeatures();
        if (specificFeatures != null) {
            for (final Element feature : specificFeatures) {
                features.add(feature);
            }
        }
        document.getRootElement().add(features);

        socketReader.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/SocketReadingMode.java