I have built a client using Apache HTTP Async Client library, I have a pool of http/https requests. The problem is that I need to execute https requests using a Certificate and Client private key. I was able to do that but there is only one SSLContext, so, once I load a Certificate+Private key there, all HTTPS requests to the endpoint are going to use those certificates+key, I need to execute a validation before doing the http request and load the certificate to the request if certain condition is valid, then, I need to be able to load the Certificate+Private key per https request.
SSLContext context = SSLContext.getInstance("SSL");
HttpAsyncClient client =
HttpAsyncClients.custom()
.setConnectionManager(manager)
.setSSLContext(context)
.build();
Thanks in advance.