ConnectTimeout is the timeout for creating a connection. Let’s say you have an unreliable server and you want to wait only 15 seconds before you tell the user that “something is wrong”.
ReadTimeout is the timeout when you have a connection, you’re blocked on read() and you want to get an exception if the read blocks for more than timeout.
To avoid the HHTP connection session cannot close. We must setup the defined setReadTimeout parameter.
HttpURLConnection urlCon = (HttpURLConnection)url.openConnection();