CronetBufferedOutputStreamTest.java 文件源码

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

项目:chromium-net-for-android 作者:
@SmallTest
@Feature({"Cronet"})
@CompareDefaultWithCronet
public void testPostWithoutContentLengthWriteOneByte() throws Exception {
    URL url = new URL(NativeTestServer.getEchoBodyURL());
    HttpURLConnection connection =
            (HttpURLConnection) url.openConnection();
    connection.setDoOutput(true);
    connection.setRequestMethod("POST");
    OutputStream out = connection.getOutputStream();
    byte[] largeData = TestUtil.getLargeData();
    for (int i = 0; i < largeData.length; i++) {
        out.write(largeData[i]);
    }
    assertEquals(200, connection.getResponseCode());
    assertEquals("OK", connection.getResponseMessage());
    TestUtil.checkLargeData(TestUtil.getResponseAsString(connection));
    connection.disconnect();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号