I\'m getting a ConnectException: Connection timed out
with some frequency from my code. The URL I am trying to hit is up. The same code works for some users,
Why would a “java.net.ConnectException: Connection timed out” exception occur when URL is up?
Because the URLConnection (HttpURLConnection/HttpsURLConnection) is erratic. You can read about this here and here. Our solution were two things:
a) set the ContentLength via setFixedLengthStreamingMode
b) catch any TimeoutException and retry if it failed.