By Alvin Alexander. Last updated: June 6, 2016
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.