use of ch.cyberduck.core.CertificateIdentityCallback in project cyberduck by iterate-ch.
the class CertificateStoreX509KeyManagerTest method testChooseClientAliasStartcom.
@Test
public void testChooseClientAliasStartcom() throws Exception {
final AtomicBoolean choose = new AtomicBoolean();
final X509KeyManager m = new CertificateStoreX509KeyManager(new DisabledCertificateIdentityCallback(), new Host(new TestProtocol(), "test2.cyberduck.ch"), new DisabledCertificateStore() {
@Override
public X509Certificate choose(final CertificateIdentityCallback prompt, final String[] keyTypes, final Principal[] issuers, final Host bookmark) throws ConnectionCanceledException {
for (Principal issuer : issuers) {
assertEquals("CN=StartCom Class 2 Primary Intermediate Client CA", issuer.getName());
}
choose.set(true);
throw new ConnectionCanceledException();
}
}).init();
assertNull(m.chooseClientAlias(new String[] { "RSA", "DSA" }, new Principal[] { new X500Principal("CN=StartCom Class 2 Primary Intermediate Client CA") }, new Socket("test.cyberduck.ch", 443)));
assertTrue(choose.get());
}
Aggregations