Setting connection time-out delay in Java

When I was working with HttpUnit, I always faced issues with connection timeout. Hey, thats not an HttpUnit issue :). To set the time-out delay, set a system property “sun.net.client.defaultReadTimeout“.

System.setProperty("sun.net.client.defaultReadTimeout", "<time in millies>");

Note:
You can read more about it here: http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html

Advertisements