Merge "Expand test coverage for disconnect during connect."
diff --git a/luni/src/test/java/libcore/java/net/URLConnectionTest.java b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
index 9231cd0..c80d2ec 100644
--- a/luni/src/test/java/libcore/java/net/URLConnectionTest.java
+++ b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
@@ -1068,7 +1068,35 @@
     }
 
     // http://b/33763156
-    public void testDisconnectDuringConnect() throws IOException {
+    public void testDisconnectDuringConnect_getInputStream() throws IOException {
+        checkDisconnectDuringConnect(HttpURLConnection::getInputStream);
+    }
+
+    // http://b/33763156
+    public void testDisconnectDuringConnect_getOutputStream() throws IOException {
+        checkDisconnectDuringConnect(HttpURLConnection::getOutputStream);
+    }
+
+    // http://b/33763156
+    public void testDisconnectDuringConnect_getResponseCode() throws IOException {
+        checkDisconnectDuringConnect(HttpURLConnection::getResponseCode);
+    }
+
+    // http://b/33763156
+    public void testDisconnectDuringConnect_getResponseMessage() throws IOException {
+        checkDisconnectDuringConnect(HttpURLConnection::getResponseMessage);
+    }
+
+    interface ConnectStrategy {
+        /**
+         * Causes the given {@code connection}, which was previously disconnected,
+         * to initiate the connection.
+         */
+        void connect(HttpURLConnection connection) throws IOException;
+    }
+
+    // http://b/33763156
+    private void checkDisconnectDuringConnect(ConnectStrategy connectStrategy) throws IOException {
         server.enqueue(new MockResponse().setBody("This should never be sent"));
         server.play();
 
@@ -1088,7 +1116,7 @@
             HttpURLConnection connection = (HttpURLConnection) server.getUrl("/").openConnection();
             connectionHolder.set(connection);
             try {
-                connection.getInputStream();
+                connectStrategy.connect(connection);
                 fail();
             } catch (IOException expected) {
                 assertEquals("Canceled", expected.getMessage());