merge in lmp-mr1-release history after reset to lmp-mr1-dev
diff --git a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java
index 1d2e2bb..0fcc4bd 100644
--- a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java
+++ b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java
@@ -430,6 +430,11 @@
HttpURLConnection connection1 = client.open(server.getUrl("/a"));
connection1.setReadTimeout(100);
assertContent("This connection won't pool properly", connection1);
+
+ // Give the server time to enact the socket policy if it's one that could happen after the
+ // client has received the response.
+ Thread.sleep(500);
+
assertEquals(0, server.takeRequest().getSequenceNumber());
HttpURLConnection connection2 = client.open(server.getUrl("/b"));
connection2.setReadTimeout(100);
@@ -687,6 +692,10 @@
client.setHostnameVerifier(new RecordingHostnameVerifier());
assertContent("abc", client.open(server.getUrl("/")));
+
+ // Give the server time to disconnect.
+ Thread.sleep(500);
+
assertContent("def", client.open(server.getUrl("/")));
RecordedRequest request1 = server.takeRequest();
@@ -1279,6 +1288,9 @@
// Seed the pool with a bad connection.
assertContent("a", client.open(server.getUrl("/")));
+ // Give the server time to disconnect.
+ Thread.sleep(500);
+
// This connection will need to be recovered. When it is, transparent gzip should still work!
assertContent("b", client.open(server.getUrl("/")));
@@ -2630,6 +2642,9 @@
assertContent("A", client.open(server.getUrl("/a")));
+ // Give the server time to disconnect.
+ Thread.sleep(500);
+
// If the request body is larger than OkHttp's replay buffer, the failure may still occur.
byte[] requestBody = new byte[requestSize];
new Random(0).nextBytes(requestBody);