/** * Adding support for SSL mutual authentication using specified keystore/truststore. Specifying * keystore/truststore is optional. If unspecified, a normal SSL scheme is created. */ public static void configureWithSslKeystoreTruststore( HttpClient client, File keystoreFile, String keystorePassword, File truststoreFile, String truststorePassword) throws CertificateException, FileNotFoundException, IOException, KeyStoreException, KeyManagementException, NoSuchAlgorithmException, UnrecoverableKeyException { // // create a new https scheme with no SSL verification // Scheme httpsScheme = SchemeFactory.createHttpsScheme( keystoreFile, keystorePassword, truststoreFile, truststorePassword); // // register this new scheme on the https client // client.getConnectionManager().getSchemeRegistry().register(httpsScheme); }