Skip to content

Commit

Permalink
Delete test that depends on an external server.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
narayank committed Feb 5, 2014
1 parent cef32f3 commit 8ebfe8f
Showing 1 changed file with 3 additions and 30 deletions.
Expand Up @@ -853,40 +853,13 @@ public void test_getLastModified() throws IOException {
((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) {
}
}

Expand Down

0 comments on commit 8ebfe8f

Please sign in to comment.