gae-interop-testing: concrete channel builders (#3678)

Do not rely on ManagedChannelBuilder to select the correct concrete
type; directly instantiate the required type.
This commit is contained in:
zpencer 2017-11-07 12:59:13 -08:00 committed by GitHub
parent 2999d24bc7
commit 6827f53785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 17 deletions

View File

@ -45,10 +45,7 @@ dependencies {
compile project(":grpc-okhttp") compile project(":grpc-okhttp")
compile project(":grpc-protobuf") compile project(":grpc-protobuf")
compile project(":grpc-stub") compile project(":grpc-stub")
compile (project(":grpc-interop-testing")) { compile project(":grpc-interop-testing")
// We want the gRPC and service definitions but NOT grpc-netty for jdk7
exclude module: ":grpc-netty"
}
} }
// [START model] // [START model]

View File

@ -16,10 +16,7 @@
package io.grpc.testing.integration; package io.grpc.testing.integration;
import static junit.framework.TestCase.assertTrue;
import io.grpc.ManagedChannel; import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.okhttp.OkHttpChannelBuilder; import io.grpc.okhttp.OkHttpChannelBuilder;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -134,10 +131,9 @@ public final class OkHttpClientInteropServlet extends HttpServlet {
public static final class Tester extends AbstractInteropTest { public static final class Tester extends AbstractInteropTest {
@Override @Override
protected ManagedChannel createChannel() { protected ManagedChannel createChannel() {
ManagedChannelBuilder<?> builder = OkHttpChannelBuilder builder =
ManagedChannelBuilder.forTarget(INTEROP_TEST_ADDRESS) OkHttpChannelBuilder.forTarget(INTEROP_TEST_ADDRESS)
.maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE); .maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE);
assertTrue(builder instanceof OkHttpChannelBuilder);
return builder.build(); return builder.build();
} }

View File

@ -16,10 +16,7 @@
package io.grpc.testing.integration; package io.grpc.testing.integration;
import static junit.framework.TestCase.assertTrue;
import io.grpc.ManagedChannel; import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.NettyChannelBuilder;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -82,12 +79,11 @@ public final class NettyClientInteropServlet extends HttpServlet {
public static final class Tester extends AbstractInteropTest { public static final class Tester extends AbstractInteropTest {
@Override @Override
protected ManagedChannel createChannel() { protected ManagedChannel createChannel() {
ManagedChannelBuilder<?> builder = NettyChannelBuilder builder =
ManagedChannelBuilder.forTarget(INTEROP_TEST_ADDRESS) NettyChannelBuilder.forTarget(INTEROP_TEST_ADDRESS)
.maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE); .maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE);
assertTrue(builder instanceof NettyChannelBuilder); builder.flowControlWindow(65 * 1024);
((NettyChannelBuilder) builder).flowControlWindow(65 * 1024);
return builder.build(); return builder.build();
} }