Skip to main content
deleted 59 characters in body
Source Link
Addev
  • 32.4k
  • 55
  • 195
  • 309

I'm trying to properly configure the timeouts for my connections using HttpURLConnection.

My problem is that after the getResponseCode() call It always timeouts after 60 seconds instead of the value I set. My code:

 URL url = new URL(uri.toString()); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setConnectTimeout(Utils.DEFAULT_CONNECT_TIMEOUT_MILLIS15000); connection.setReadTimeout(Utils.DEFAULT_READ_TIMEOUT_MILLIS15000); int responseCode = connection.getResponseCode(); 

What do I am missing?

I'm trying to properly configure the timeouts for my connections using HttpURLConnection.

My problem is that after the getResponseCode() call It always timeouts after 60 seconds instead of the value I set. My code:

 URL url = new URL(uri.toString()); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setConnectTimeout(Utils.DEFAULT_CONNECT_TIMEOUT_MILLIS); connection.setReadTimeout(Utils.DEFAULT_READ_TIMEOUT_MILLIS); int responseCode = connection.getResponseCode(); 

What do I am missing?

I'm trying to properly configure the timeouts for my connections using HttpURLConnection.

My problem is that after the getResponseCode() call It always timeouts after 60 seconds instead of the value I set. My code:

 URL url = new URL(uri.toString()); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setConnectTimeout(15000); connection.setReadTimeout(15000); int responseCode = connection.getResponseCode(); 

What do I am missing?

Source Link
Addev
  • 32.4k
  • 55
  • 195
  • 309

HttpURLConnection timeout seems to be ignored

I'm trying to properly configure the timeouts for my connections using HttpURLConnection.

My problem is that after the getResponseCode() call It always timeouts after 60 seconds instead of the value I set. My code:

 URL url = new URL(uri.toString()); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setConnectTimeout(Utils.DEFAULT_CONNECT_TIMEOUT_MILLIS); connection.setReadTimeout(Utils.DEFAULT_READ_TIMEOUT_MILLIS); int responseCode = connection.getResponseCode(); 

What do I am missing?