@Test
public void shouldBeResilientAgainstNullSubjectAlternativeNames()
        throws CertificateException, IllegalAccessException, NoSuchFieldException, SecurityException {

    writeField(subject, "defaultTrustManager", defaultTrustManager, true);
    when(topOfChain.getSubjectX500Principal())
            .thenReturn(new X500Principal("CN=example.com, OU=Smarthome, O=Eclipse, C=DE"));
    when(topOfChain.getSubjectAlternativeNames()).thenReturn(null);
    subject.checkClientTrusted(chain, "just");
    verify(defaultTrustManager).checkClientTrusted(chain, "just", (Socket) null);
    verifyNoMoreInteractions(trustmanager);
}