From 3bb3a2641f8536944eb4d71e299a17794fdf34a4 Mon Sep 17 00:00:00 2001 From: Louis Ryan Date: Thu, 11 Aug 2016 17:49:16 -0700 Subject: [PATCH 1/3] Stop hardcoding Netty dependency so example works on Android Using ManagedChannelBuilder allows GRPC to auto-detect the best transport for the runtime environment on which this code will run. --- .../java/com/examples/cloud/speech/AsyncRecognizeClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java b/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java index c86b4d27f50..e4c0f3d05e5 100644 --- a/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java +++ b/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java @@ -88,7 +88,7 @@ public static ManagedChannel createChannel(String host, int port) throws IOExcep GoogleCredentials creds = GoogleCredentials.getApplicationDefault(); creds = creds.createScoped(OAUTH2_SCOPES); ManagedChannel channel = - NettyChannelBuilder.forAddress(host, port) + ManagedChannelBuilder.forAddress(host, port) .negotiationType(NegotiationType.TLS) .intercept(new ClientAuthInterceptor(creds, Executors.newSingleThreadExecutor())) .build(); From 680c4b64c8d823cb25523deb2f570ba55ca74c72 Mon Sep 17 00:00:00 2001 From: Louis Ryan Date: Tue, 16 Aug 2016 11:39:58 -0700 Subject: [PATCH 2/3] Update AsyncRecognizeClient.java --- .../java/com/examples/cloud/speech/AsyncRecognizeClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java b/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java index e4c0f3d05e5..25b39b837f1 100644 --- a/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java +++ b/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java @@ -29,6 +29,7 @@ import com.google.longrunning.OperationsGrpc; import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; import io.grpc.StatusRuntimeException; import io.grpc.auth.ClientAuthInterceptor; import io.grpc.netty.NegotiationType; From 4762ef0601ef9f88c3613ebdad43750b2ad1e6b4 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Thu, 1 Sep 2016 14:39:10 -0700 Subject: [PATCH 3/3] Remove references to missing methods and imports. The Netty imports are no longer used, so checkstyle was failing. --- .../java/com/examples/cloud/speech/AsyncRecognizeClient.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java b/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java index fea1839fdf9..9d9d5899a4b 100644 --- a/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java +++ b/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java @@ -31,8 +31,6 @@ import io.grpc.ManagedChannelBuilder; import io.grpc.StatusRuntimeException; import io.grpc.auth.ClientAuthInterceptor; -import io.grpc.netty.NegotiationType; -import io.grpc.netty.NettyChannelBuilder; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; @@ -88,7 +86,6 @@ public static ManagedChannel createChannel(String host, int port) throws IOExcep creds = creds.createScoped(OAUTH2_SCOPES); ManagedChannel channel = ManagedChannelBuilder.forAddress(host, port) - .negotiationType(NegotiationType.TLS) .intercept(new ClientAuthInterceptor(creds, Executors.newSingleThreadExecutor())) .build();