@Override
    public List<Element> getAvailableStreamFeatures()
    {
        final List<Element> result = new LinkedList<>();

        // Include Stream Compression Mechanism
        if (conn.getConfiguration().getCompressionPolicy() != Connection.CompressionPolicy.disabled && !conn.isCompressed()) {
            final Element compression = DocumentHelper.createElement(QName.get("compression", "http://jabber.org/features/compress"));
            compression.addElement("method").addText("zlib");
            result.add(compression);
        }
        
        // Offer server dialback if using self-signed certificates and no authentication has been done yet
        boolean usingSelfSigned;
        final Certificate[] chain = conn.getLocalCertificates();
        if (chain == null || chain.length == 0) {
            usingSelfSigned = true;
        } else {
            usingSelfSigned = CertificateManager.isSelfSignedCertificate((X509Certificate) chain[0]);
        }
        
        if (usingSelfSigned && ServerDialback.isEnabledForSelfSigned() && validatedDomains.isEmpty()) {
            final Element dialback = DocumentHelper.createElement(QName.get("dialback", "urn:xmpp:features:dialback"));
            dialback.addElement("errors");
            result.add(dialback);
        }

        if (!ConnectionSettings.Server.STREAM_LIMITS_ADVERTISEMENT_DISABLED.getValue()) {
            final Element limits = DocumentHelper.createElement(QName.get("limits", "urn:xmpp:stream-limits:0"));
            limits.addElement("max-bytes").addText(String.valueOf(XMLLightweightParser.XMPP_PARSER_BUFFER_SIZE.getValue()));
            final Duration timeout = ConnectionSettings.Server.IDLE_TIMEOUT_PROPERTY.getValue();
            if (!timeout.isNegative() && !timeout.isZero()) {
                limits.addElement("idle-seconds").addText(String.valueOf(timeout.toSeconds()));
            }
            result.add(limits);
        }
        return result;
    }
Verifies the received key sent by the remote server. This server is trying to generate
an outgoing connection to the remote server and the remote server is reusing an incoming
connection for validating the key.

@param doc the received Element that contains the key to verify.
xmppserver/src/main/java/org/jivesoftware/openfire/session/LocalIncomingServerSession.java