My program is supposed to make multiple POST requests to a https site and I need it to do a SSL-handshake each time it does a new request. However it seems to only do the handshake the first time and then use the existing connection to do the other requests without a new handshake. I'm sure it doesn't do the handshake later times, because the first time it takes about 700 ms to do the request and receive a response, but later ones only take about 30 ms.
Here's how I initialize the client: (Am I missing some property here?)
SSLContext context = SSLContext.getInstance("SSL");
context.init(kms, trustAllCerts, null);
SSLContext.setDefault(context);
ClientConfig config = new DefaultClientConfig();
config.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, timeout * 1000);
config.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, false);
config.getFeatures().put(ClientConfig.FEATURE_DISABLE_XML_SECURITY, true);
client = Client.create(config);
And here's how I make the actual request:
ClientResponse cr = service.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML).post(ClientResponse.class, batch);
(The service variable is the Builder class, which creates the ClientRequest. It's where the URL is specified.)
Any ideas, please?