public static Set<String> determineSubjectAlternateNameDnsNameValues()
    {
        final HashSet<String> result = new HashSet<>();

        // Add the XMPP domain name itself.
        result.add( XMPPServer.getInstance().getServerInfo().getXMPPDomain() );

        // The fully qualified domain name of the server
        result.add( XMPPServer.getInstance().getServerInfo().getHostname() );

        if ( XMPPServer.getInstance().getIQDiscoItemsHandler() != null ) // When we're not in setup any longer...
        {
            // Add the name of each of the domain level item nodes as reported by service discovery.
            for ( final DiscoItem item : XMPPServer.getInstance().getIQDiscoItemsHandler().getServerItems() )
            {
                result.add( item.getJID().toBareJID() );
            }
        }

        return result;
    }
Finds all values that aught to be added as a Subject Alternate Name of the dnsName type to a certificate that
identifies this XMPP server.

@return A set of names, possibly empty, never null.
xmppserver/src/main/java/org/jivesoftware/util/CertificateManager.java