private CallbackHandler createClientCallbackHandler( final String[] mechanisms, final X509KeyManager keyManager, final X509TrustManager trustManager) throws Exception { final AuthenticationContext context = AuthenticationContext.empty() .with( MatchRule.ALL, AuthenticationConfiguration.EMPTY .useKeyManagerCredential(keyManager) .useTrustManager(trustManager) .allowSaslMechanisms(mechanisms)); return ClientUtils.getCallbackHandler(new URI("remote://localhost"), context); }