/**
* Tests write after connect. Strangely, the default implementation allows
* writing after being connected, so this test only runs against Cronet's
* implementation.
*/
@SmallTest
@Feature({"Cronet"})
@OnlyRunCronetHttpURLConnection
public void testWriteAfterConnect() throws Exception {
URL url = new URL(NativeTestServer.getEchoBodyURL());
HttpURLConnection connection =
(HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
OutputStream out = connection.getOutputStream();
out.write(TestUtil.UPLOAD_DATA);
connection.connect();
try {
// Attemp to write some more.
out.write(TestUtil.UPLOAD_DATA);
fail();
} catch (IllegalStateException e) {
assertEquals("Cannot write after being connected.", e.getMessage());
}
}
CronetBufferedOutputStreamTest.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:chromium-net-for-android
作者:
评论列表
文章目录