I am using HttpClient 4.1.2
HttpGet httpget = new HttpGet(uri);
HttpResponse response = httpClient.execute(httpget);
So, how can I get the
Based on the example in the initial question, the way to access the CookieStore after executing an HTTP request, is by using the HttpContext execution state object.
HttpContext will reference a cookie store (new if no CookieStore was specified in the HttpClientBuilder) after a request is executed.
HttpClientContext context = new HttpClientContext();
CloseableHttpResponse response = httpClient.execute(request, context);
CookieStore cookieStore = context.getCookieStore();
This applies on httpcomponents-client:4.3+ when the ClosableHttpClient was introduced.