Here is my Main Method:
public static void main(String[] args) {
BasicCookieStore cookieStore = null;
HttpResponse httpResponse = null;
HttpClient httpClient = HttpClients.createDefault();
while (true) {
HttpUriRequest request = new HttpGet("http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/HttpClientBuilder.html");
try {
httpResponse = httpClient.execute(request);
System.out.println(httpResponse.getStatusLine().getStatusCode());
} catch (Exception e) {
System.out.println(httpResponse.getStatusLine().getStatusCode());
e.printStackTrace();
}
}
}
After executing 2 times the HttpClient stop executing the same HttpGet. While, I instantiate a new HttpClient in the loop, it won't stop. I wander if there is something strategy preventing the HttpClient from executing the same HttpGet method more than 2 times? Who can help me, I will be very grateful!