@Test public void testChooseEngineClientAliasReturnsGivenAlias() { String wrapperAlias = "wrapperAlias"; String myDelegateAlias = "delegateAlias"; X509ExtendedKeyManager mock = mock(X509ExtendedKeyManager.class); when(mock.chooseEngineClientAlias(any(String[].class), any(Principal[].class), any(SSLEngine.class))).thenReturn(myDelegateAlias); X509ExtendedKeyManager wrapper = new X509AliasKeyManager(wrapperAlias, mock); assertEquals("Expected wrapper alias", wrapperAlias, wrapper.chooseEngineClientAlias(new String[0], new Principal[0], mock(SSLEngine.class))); }
@Override public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) { return alias; }
X509AliasKeyManager extends X509ExtendedKeyManager { @Override public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) { return alias; } }
X509AliasKeyManager extends X509ExtendedKeyManager { @Override public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) { return alias; } X509AliasKeyManager(String alias, X509ExtendedKeyManager delegate); }
X509AliasKeyManager extends X509ExtendedKeyManager { @Override public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) { return alias; } X509AliasKeyManager(String alias, X509ExtendedKeyManager delegate); @Override String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket); @Override String chooseServerAlias(String keyType, Principal[] issuers, Socket socket); @Override X509Certificate[] getCertificateChain(String alias); @Override String[] getClientAliases(String keyType, Principal[] issuers); @Override PrivateKey getPrivateKey(String alias); @Override String[] getServerAliases(String keyType, Principal[] issuers); @Override String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine); @Override String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine); }
X509AliasKeyManager extends X509ExtendedKeyManager { @Override public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) { return alias; } X509AliasKeyManager(String alias, X509ExtendedKeyManager delegate); @Override String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket); @Override String chooseServerAlias(String keyType, Principal[] issuers, Socket socket); @Override X509Certificate[] getCertificateChain(String alias); @Override String[] getClientAliases(String keyType, Principal[] issuers); @Override PrivateKey getPrivateKey(String alias); @Override String[] getServerAliases(String keyType, Principal[] issuers); @Override String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine); @Override String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine);  }