KeyManagerProxy extends X509ExtendedKeyManager { @Override public X509Certificate[] getCertificateChain(String s) { return keyManager.getCertificateChain(s); } KeyManagerProxy(KeyManager[] keyManagers); void setKeyManager(final KeyManager[] keyManagers); @Override String[] getClientAliases(String s, Principal[] principals); @Override String chooseClientAlias(String[] strings, Principal[] principals, Socket socket); @Override String[] getServerAliases(String s, Principal[] principals); @Override String chooseServerAlias(String s, Principal[] principals, Socket socket); @Override X509Certificate[] getCertificateChain(String s); @Override PrivateKey getPrivateKey(String s); @Override String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine); @Override String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine);  }
@Test public void testKeyManagerProxyGetCertificateChain(@Mocked X509ExtendedKeyManager mockedKeyManager) { new Expectations() {{ mockedKeyManager.getCertificateChain("cert"); times = 1; }}; KeyManagerProxy keyManagerProxy = new KeyManagerProxy(new KeyManager[]{mockedKeyManager}); keyManagerProxy.getCertificateChain("cert"); }