How to set a timeout on an Apache HttpClient:
HttpClient client = new DefaultHttpClient(); client.getParams().setParameter("http.socket.timeout", new Integer(10*1000));
I like to make my code easier to read, so I use the "10*1000" there to make it easier to read that I want a ten-second timeout.
There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.