/**
* Tests that {@link CronetBufferedOutputStream} supports rewind in a
* POST preserving redirect.
* Use {@code OnlyRunCronetHttpURLConnection} as the default implementation
* does not pass this test.
*/
@SmallTest
@Feature({"Cronet"})
@OnlyRunCronetHttpURLConnection
public void testRewind() throws Exception {
URL url = new URL(NativeTestServer.getRedirectToEchoBody());
HttpURLConnection connection =
(HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty(
"Content-Length", Integer.toString(TestUtil.UPLOAD_DATA.length));
OutputStream out = connection.getOutputStream();
out.write(TestUtil.UPLOAD_DATA);
assertEquals(TestUtil.UPLOAD_DATA_STRING, TestUtil.getResponseAsString(connection));
connection.disconnect();
}
CronetBufferedOutputStreamTest.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:chromium-net-for-android
作者:
评论列表
文章目录