CronetBufferedOutputStreamTest.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:chromium-net-for-android 作者:
@SmallTest
@Feature({"Cronet"})
@CompareDefaultWithCronet
public void testWriteAfterReadingResponse() throws Exception {
    URL url = new URL(NativeTestServer.getEchoBodyURL());
    HttpURLConnection connection =
            (HttpURLConnection) url.openConnection();
    connection.setDoOutput(true);
    connection.setRequestMethod("POST");
    OutputStream out = connection.getOutputStream();
    assertEquals(200, connection.getResponseCode());
    try {
        out.write(TestUtil.UPLOAD_DATA);
        fail();
    } catch (Exception e) {
        // Default implementation gives an IOException and says that the
        // stream is closed. Cronet gives an IllegalStateException and
        // complains about write after connected.
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号