• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

SSLHandshake is too slow (HttpUrlConnection)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic