From 0dbab26bb45cc95b4c7fb4889e0f558128afc0ee Mon Sep 17 00:00:00 2001 From: ZHANG Dapeng Date: Fri, 1 Feb 2019 17:06:27 -0800 Subject: [PATCH] all: fix lint --- core/src/main/java/io/grpc/internal/ClientCallImpl.java | 2 +- .../test/java/io/grpc/testing/integration/ProxyTest.java | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/io/grpc/internal/ClientCallImpl.java b/core/src/main/java/io/grpc/internal/ClientCallImpl.java index 9248f9cc5e..6f1bd12805 100644 --- a/core/src/main/java/io/grpc/internal/ClientCallImpl.java +++ b/core/src/main/java/io/grpc/internal/ClientCallImpl.java @@ -202,7 +202,7 @@ final class ClientCallImpl extends ClientCall { return; } final String compressorName = callOptions.getCompressor(); - Compressor compressor = null; + Compressor compressor; if (compressorName != null) { compressor = compressorRegistry.lookupCompressor(compressorName); if (compressor == null) { diff --git a/interop-testing/src/test/java/io/grpc/testing/integration/ProxyTest.java b/interop-testing/src/test/java/io/grpc/testing/integration/ProxyTest.java index a80835e4b6..c336ee9aea 100644 --- a/interop-testing/src/test/java/io/grpc/testing/integration/ProxyTest.java +++ b/interop-testing/src/test/java/io/grpc/testing/integration/ProxyTest.java @@ -18,6 +18,7 @@ package io.grpc.testing.integration; import static org.junit.Assert.assertEquals; +import com.google.common.io.ByteStreams; import io.netty.util.concurrent.DefaultThreadFactory; import java.io.DataInputStream; import java.io.IOException; @@ -139,7 +140,6 @@ public class ProxyTest { proxy = new TrafficControlProxy(serverPort, bandwidth, 200, TimeUnit.MILLISECONDS); proxy.start(); client = new Socket("localhost", proxy.getPort()); - OutputStream clientOut = client.getOutputStream(); DataInputStream clientIn = new DataInputStream(client.getInputStream()); clientIn.readFully(new byte[100 * 1024]); @@ -167,7 +167,6 @@ public class ProxyTest { proxy = new TrafficControlProxy(serverPort, bandwidth, 200, TimeUnit.MILLISECONDS); proxy.start(); client = new Socket("localhost", proxy.getPort()); - OutputStream clientOut = client.getOutputStream(); DataInputStream clientIn = new DataInputStream(client.getInputStream()); clientIn.readFully(new byte[100 * 1024]); @@ -224,11 +223,7 @@ public class ProxyTest { InputStream serverIn = rcv.getInputStream(); OutputStream serverOut = rcv.getOutputStream(); if (mode.equals("echo")) { - byte[] response = new byte[1024]; - int readable; - while ((readable = serverIn.read(response)) != -1) { - serverOut.write(response, 0, readable); - } + ByteStreams.copy(serverIn, serverOut); } else if (mode.equals("stream")) { byte[] message = new byte[1024]; while (true) {