diff options
| author | Lorenzo Colitti <lorenzo@google.com> | 2014-07-18 02:05:54 +0900 |
|---|---|---|
| committer | Lorenzo Colitti <lorenzo@google.com> | 2014-07-23 23:28:23 +0900 |
| commit | 1410c75d4b2334521208259b69c23aeefec072d7 (patch) | |
| tree | a156bf3baa14c1c19431c91b1f1fa538e9aed49c /okhttp | |
| parent | 3f968acf193178145e9d227f2f08b95e2d6a6c26 (diff) | |
| download | android_external_okhttp-1410c75d4b2334521208259b69c23aeefec072d7.tar.gz android_external_okhttp-1410c75d4b2334521208259b69c23aeefec072d7.tar.bz2 android_external_okhttp-1410c75d4b2334521208259b69c23aeefec072d7.zip | |
Use the socket factory for direct connections as well.
Currently, the passed-in socket factory is only used for
connections to HTTP proxies. I think this was not the intent of
the original socket factory change, because the commit message
said that the "socket factory will be used for all non-proxy
connections and HTTP proxy connections". So use it for DIRECT
connections as well.
Also add a test to check that a socket factory is used if
specified.
Cherry-pick of https://github.com/square/okhttp/commit/7f763c1a18e342dc4e2840c68ca99c175c37eb93
(cherry picked from commit a83ddf194ffbae04ce536967efff0ec72df70e10)
Change-Id: Ie3d239d8683a51a2b6ab1dc9d443886d0746e68a
Diffstat (limited to 'okhttp')
| -rw-r--r-- | okhttp/src/main/java/com/squareup/okhttp/Connection.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/okhttp/src/main/java/com/squareup/okhttp/Connection.java b/okhttp/src/main/java/com/squareup/okhttp/Connection.java index 9080ae8..39ca4d0 100644 --- a/okhttp/src/main/java/com/squareup/okhttp/Connection.java +++ b/okhttp/src/main/java/com/squareup/okhttp/Connection.java @@ -138,10 +138,10 @@ public final class Connection implements Closeable { throws IOException { if (connected) throw new IllegalStateException("already connected"); - if (route.proxy.type() != Proxy.Type.HTTP) { - socket = new Socket(route.proxy); - } else { + if (route.proxy.type() == Proxy.Type.DIRECT || route.proxy.type() == Proxy.Type.HTTP) { socket = route.address.socketFactory.createSocket(); + } else { + socket = new Socket(route.proxy); } socket.setSoTimeout(readTimeout); |
