I am writing a Java application that can log in and shop on a website. I have a problem when my HttpClient hangs when I try to execute a second HttpResponse / Post. He used to work well, not knowing why he started hanging out. I get no errors, he just sits there and gets stuck. The only change I made that could cause it to freeze is that I use HttpGet to retrieve the tokens so that I can log in to the site.
This is how I configure httpClient
private static BasicCookieStore cookieStore = new BasicCookieStore(); private static HttpClient httpClient = HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build();
The rest is just standard httpget and httppost and then httpclient.execute ();
The first sequence is that my program requests a website and retrieves a token, then I send a POST with a login token. After that, my program again requests a website for product information, and then adds it to the cart. But it hangs on the second POST.
Can I skip a flash somewhere? I read somewhere that this HttpClient method is closing. And DefaultHttpClient has been discounted.
user3630509
source share