From ba51f5bff8a312b618ad94bc248cf4cb61c8e5ea Mon Sep 17 00:00:00 2001 From: jwilson Date: Mon, 2 May 2016 00:48:15 -0400 Subject: [PATCH] Upgrade to Okio 1.8.0. --- .../src/test/java/okhttp3/SocksProxy.java | 2 +- .../internal/ws/WebSocketWriterTest.java | 20 +++++++++---------- .../okhttp3/internal/ws/WebSocketReader.java | 2 +- .../okhttp3/internal/ws/WebSocketWriter.java | 4 ++-- .../src/main/java/okhttp3/internal/Util.java | 2 +- pom.xml | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/okhttp-tests/src/test/java/okhttp3/SocksProxy.java b/okhttp-tests/src/test/java/okhttp3/SocksProxy.java index ce949ebaef73..9c1b5a83cb04 100644 --- a/okhttp-tests/src/test/java/okhttp3/SocksProxy.java +++ b/okhttp-tests/src/test/java/okhttp3/SocksProxy.java @@ -208,7 +208,7 @@ private void transfer(final InetAddress fromAddress, final InetAddress toAddress Buffer buffer = new Buffer(); try { while (true) { - long byteCount = source.read(buffer, 2048L); + long byteCount = source.read(buffer, 8192L); if (byteCount == -1L) break; sink.write(buffer, byteCount); sink.emit(); diff --git a/okhttp-ws-tests/src/test/java/okhttp3/internal/ws/WebSocketWriterTest.java b/okhttp-ws-tests/src/test/java/okhttp3/internal/ws/WebSocketWriterTest.java index bdeff21c1538..384151cf4adb 100644 --- a/okhttp-ws-tests/src/test/java/okhttp3/internal/ws/WebSocketWriterTest.java +++ b/okhttp-ws-tests/src/test/java/okhttp3/internal/ws/WebSocketWriterTest.java @@ -118,16 +118,16 @@ public final class WebSocketWriterTest { sink.write(body.readByteString(20_000)); sink.close(); - assertData("017e4800"); - assertData(bytes.readByteArray(18_432)); - assertData("007e5000"); - assertData(bytes.readByteArray(20_480)); - assertData("007e5000"); - assertData(bytes.readByteArray(20_480)); - assertData("007e5000"); - assertData(bytes.readByteArray(20_480)); - assertData("007e4800"); - assertData(bytes.readByteArray(18_432)); + assertData("017e4000"); + assertData(bytes.readByteArray(16_384)); + assertData("007e4000"); + assertData(bytes.readByteArray(16_384)); + assertData("007e6000"); + assertData(bytes.readByteArray(24_576)); + assertData("007e4000"); + assertData(bytes.readByteArray(16_384)); + assertData("007e6000"); + assertData(bytes.readByteArray(24_576)); assertData("807e06a0"); assertData(bytes.readByteArray(1_696)); assertTrue(data.exhausted()); diff --git a/okhttp-ws/src/main/java/okhttp3/internal/ws/WebSocketReader.java b/okhttp-ws/src/main/java/okhttp3/internal/ws/WebSocketReader.java index 6a72c6c77e62..8be28a2c5a09 100644 --- a/okhttp-ws/src/main/java/okhttp3/internal/ws/WebSocketReader.java +++ b/okhttp-ws/src/main/java/okhttp3/internal/ws/WebSocketReader.java @@ -80,7 +80,7 @@ public interface FrameCallback { private boolean isMasked; private final byte[] maskKey = new byte[4]; - private final byte[] maskBuffer = new byte[2048]; + private final byte[] maskBuffer = new byte[8192]; public WebSocketReader(boolean isClient, BufferedSource source, FrameCallback frameCallback) { if (source == null) throw new NullPointerException("source == null"); diff --git a/okhttp-ws/src/main/java/okhttp3/internal/ws/WebSocketWriter.java b/okhttp-ws/src/main/java/okhttp3/internal/ws/WebSocketWriter.java index 5d86be401987..6ce0cfdd0a0b 100644 --- a/okhttp-ws/src/main/java/okhttp3/internal/ws/WebSocketWriter.java +++ b/okhttp-ws/src/main/java/okhttp3/internal/ws/WebSocketWriter.java @@ -70,7 +70,7 @@ public WebSocketWriter(boolean isClient, BufferedSink sink, Random random) { // Masks are only a concern for client writers. maskKey = isClient ? new byte[4] : null; - maskBuffer = isClient ? new byte[2048] : null; + maskBuffer = isClient ? new byte[8192] : null; } /** Send a ping with the supplied {@code payload}. Payload may be {@code null} */ @@ -239,7 +239,7 @@ private final class FrameSink implements Sink { // Determine if this is a buffered write which we can defer until close() flushes. boolean deferWrite = isFirstFrame && contentLength != -1 - && buffer.size() > contentLength - 2048 /* segment size */; + && buffer.size() > contentLength - 8192 /* segment size */; long emitCount = buffer.completeSegmentByteCount(); if (emitCount > 0 && !deferWrite) { diff --git a/okhttp/src/main/java/okhttp3/internal/Util.java b/okhttp/src/main/java/okhttp3/internal/Util.java index f2b1e70d46e3..0d7211640505 100644 --- a/okhttp/src/main/java/okhttp3/internal/Util.java +++ b/okhttp/src/main/java/okhttp3/internal/Util.java @@ -175,7 +175,7 @@ public static boolean skipAll(Source source, int duration, TimeUnit timeUnit) th source.timeout().deadlineNanoTime(now + Math.min(originalDuration, timeUnit.toNanos(duration))); try { Buffer skipBuffer = new Buffer(); - while (source.read(skipBuffer, 2048) != -1) { + while (source.read(skipBuffer, 8192) != -1) { skipBuffer.clear(); } return true; // Success! The source has been exhausted. diff --git a/pom.xml b/pom.xml index 6fdbe7dc1cd6..bfe2a19791f9 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ 16.0 1.7 1.1.0 - 1.6.0 + 1.8.0 4.11