I am using :
URL url = new URL(<some url>);
HttpURLConnection huc= (HttpURLConnection) url.openConnection();
I want the connection to close if its not able to establish connction (or anything goes wrong during getting connection) afer a given amount of time. I don't want it to hang up the connection for ever.
How can I do that ?