posted 9 years ago
I send HTTP request by using HttpUrlConnection.
I send request and take response code. And after that I get the response's inputstream and use it.
My code is something like that:
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setConnectTimeout(5000);
con.setReadTimeout(10000);
int responseCode = con.getResponseCode();
InputStream is = con.getInputStream();
.....
The code works excellent.But I have a problem. Sometimes it waits 3-4 minutes before sending HTTP request and after a long time wait it continue working succesfully. So the only problem is why it sometimes waits 3 or 4 minutes before sending http reqeust succesfully.
I debug my code and I guess I found where it waits. Here is the SSL debug results.
**DEBUG RESULT:**
trigger seeding of SecureRandom
done seeding SecureRandom
::::::IT WAITS HERE 3 OR 4 MINUTES.AND THEN CONTINUE:::::
Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
Note that it only happens sometimes,not always. Is it because of proxy or another thing?