Delete test that depends on an external server.
This is correctly tested in libcore.java.net.URLConnectionTest
so there's no need for a badly written duplicate test.
bug: 12864018
(cherry picked from commit 4dd526880a8bf351508fe0d4b2b5cabc3d107527)
Change-Id: I0016298b8970bb937900a8e39aca2f4f252a7a1c
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java
index 3ca11f7..21832e7 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java
@@ -853,40 +853,13 @@
((HttpURLConnection) uc).disconnect();
}
- public void test_getOutputStream() throws IOException {
- String posted = "this is a test";
- URLConnection uc3 = new URL("http://www.google.com/ie").openConnection();
- uc3.setDoOutput(true);
- uc3.connect();
-
- BufferedWriter w = new BufferedWriter(new OutputStreamWriter(uc3
- .getOutputStream()), posted.getBytes().length);
-
- w.write(posted);
- w.flush();
- w.close();
-
- int code = ((HttpURLConnection) uc3).getResponseCode();
-
- // writing to url not allowed
- assertEquals("Got different responseCode ", 405, code);
-
- // try exception testing
- try {
- fileURLCon.setDoOutput(true);
- fileURLCon.connect();
- fileURLCon.getInputStream().close();
- fileURLCon.getOutputStream();
- } catch (UnknownServiceException expected) {
- }
-
+ public void test_getOutputStream_failAfterDisconnect() throws IOException {
((HttpURLConnection) uc2).disconnect();
try {
uc2.getOutputStream();
- fail("Exception expected");
- } catch (IOException e) {
- // ok
+ fail();
+ } catch (IOException expected) {
}
}