aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2015-09-30 18:20:14 +0100
committerNeil Fuller <nfuller@google.com>2015-09-30 18:20:14 +0100
commite0d02d710cd1bbcc1a9065ede7f6801f72abe5b7 (patch)
tree396c38bbbd6d79d98984706395c56a3e10546568
parentff23ada45194221b1ab85e83e846977927ea83c0 (diff)
downloadokhttp-e0d02d710cd1bbcc1a9065ede7f6801f72abe5b7.tar.gz
Reduce the memory requirements of a test
Equivalent change to upstream pull request #1888. URLConnectionTest.testWrites allocates a 16MB buffer. It can run in less memory (and causes problems on low-spec Android devices). 4k is the typical smallest allowable buffer size on Linux. Bug: 24403364 Change-Id: I81e60c89b2463e9131c4a76521f9baa2187cdbda
-rw-r--r--okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java
index 3be5a2d..f541c31 100644
--- a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java
+++ b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java
@@ -2222,7 +2222,7 @@ public final class URLConnectionTest {
@Test public void writeTimeouts() throws IOException {
// Sockets on some platforms can have large buffers that mean writes do not block when
// required. These socket factories explicitly set the buffer sizes on sockets created.
- final int SOCKET_BUFFER_SIZE = 256 * 1024;
+ final int SOCKET_BUFFER_SIZE = 4 * 1024;
server.get().setServerSocketFactory(
new DelegatingServerSocketFactory(ServerSocketFactory.getDefault()) {
@Override
@@ -2247,7 +2247,7 @@ public final class URLConnectionTest {
connection.setChunkedStreamingMode(0);
OutputStream out = connection.getOutputStream();
try {
- byte[] data = new byte[16 * 1024 * 1024]; // 16 MiB.
+ byte[] data = new byte[2 * 1024 * 1024]; // 2 MiB.
out.write(data);
fail();
} catch (SocketTimeoutException expected) {