@Test
    public void testServerIdentitiesDNS() throws Exception
    {
        // Setup fixture.
        final String subjectCommonName = "MySubjectCommonName";
        final String subjectAltNameDNS = "MySubjectAltNameDNS";

        final X509v3CertificateBuilder builder = new JcaX509v3CertificateBuilder(
                new X500Name( "CN=MyIssuer" ),                          // Issuer
                BigInteger.valueOf( Math.abs( new SecureRandom().nextInt() ) ), // Random serial number
                Date.from( Instant.now().plus(Duration.ofDays(30)) ),           // Not before 30 days ago
                Date.from( Instant.now().minus(Duration.ofDays(99)) ),          // Not after 99 days from now
                new X500Name( "CN=" + subjectCommonName ),              // Subject
                subjectKeyPair.getPublic()
        );

        final GeneralNames generalNames = new GeneralNames(new GeneralName(GeneralName.dNSName, subjectAltNameDNS));

        builder.addExtension( Extension.subjectAlternativeName, false, generalNames );

        final X509CertificateHolder certificateHolder = builder.build( contentSigner );
        X509Certificate cert = new JcaX509CertificateConverter().getCertificate( certificateHolder );

        // FIXME: Unsure why, but without this back-and-forth, tests will fail on Java 17.
        final String value = CertificateManager.toPemRepresentation(cert);
        final Collection<X509Certificate> chain = CertificateManager.parseCertificates(value);
        cert = chain.iterator().next();

        // Execute system under test
        final List<String> serverIdentities = CertificateManager.getServerIdentities( cert );

        // Verify result
        assertEquals( 1, serverIdentities.size() );
        assertTrue( serverIdentities.contains( subjectAltNameDNS ) );
        assertFalse( serverIdentities.contains( subjectCommonName ) );
    }
{@link CertificateManager#getServerIdentities(X509Certificate)} should return:
<ul>
    <li>the DNS subjectAltName value</li>
    <li>explicitly not the Common Name</li>
</ul>

when a certificate contains:
<ul>
    <li>a subjectAltName entry of type DNS </li>
</ul>
xmppserver/src/test/java/org/jivesoftware/util/CertificateManagerTest.java