Explicitly set Http(s)URLConnection timeouts
The defaults are changing upstream with change
https://github.com/square/okhttp/commit/0de14e992c228fd9de9fe78417788131bee00902
to 10 seconds.
If the timeouts are not set explicitly the behavior will change
next time Android pulls from upstream.
Change-Id: I3702f2a98fbcb547518e50574a504ebd9e81bf68
diff --git a/android/main/java/com/squareup/okhttp/HttpHandler.java b/android/main/java/com/squareup/okhttp/HttpHandler.java
index f7518ad..22a0b15 100644
--- a/android/main/java/com/squareup/okhttp/HttpHandler.java
+++ b/android/main/java/com/squareup/okhttp/HttpHandler.java
@@ -26,6 +26,7 @@
import java.net.URLStreamHandler;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.TimeUnit;
public class HttpHandler extends URLStreamHandler {
@@ -67,6 +68,11 @@
public static OkUrlFactory createHttpOkUrlFactory(Proxy proxy) {
OkHttpClient client = new OkHttpClient();
+ // Explicitly set the timeouts to infinity.
+ client.setConnectTimeout(0, TimeUnit.MILLISECONDS);
+ client.setReadTimeout(0, TimeUnit.MILLISECONDS);
+ client.setWriteTimeout(0, TimeUnit.MILLISECONDS);
+
// Do not permit http -> https and https -> http redirects.
client.setFollowSslRedirects(false);