mirror of https://github.com/grpc/grpc-java.git
Update Android interop test App to use ManagedChannelBuilder
This commit is contained in:
parent
ad70a28d21
commit
ee56c4940d
|
|
@ -11,3 +11,7 @@
|
||||||
|
|
||||||
-dontwarn com.google.common.**
|
-dontwarn com.google.common.**
|
||||||
-dontwarn okio.**
|
-dontwarn okio.**
|
||||||
|
|
||||||
|
# Need to create channel through service provider.
|
||||||
|
-keepnames class io.grpc.ManagedChannelProvider
|
||||||
|
-keep class io.grpc.okhttp.OkHttpChannelProvider
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ import static junit.framework.Assert.fail;
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
import io.grpc.ClientCall;
|
import io.grpc.ClientCall;
|
||||||
import io.grpc.ManagedChannel;
|
import io.grpc.ManagedChannel;
|
||||||
|
import io.grpc.ManagedChannelBuilder;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.StatusRuntimeException;
|
import io.grpc.StatusRuntimeException;
|
||||||
import io.grpc.android.integrationtest.nano.Messages;
|
import io.grpc.android.integrationtest.nano.Messages;
|
||||||
|
|
@ -133,7 +134,7 @@ public final class InteropTester extends AsyncTask<Void, Void, String> {
|
||||||
this.testCase = testCase;
|
this.testCase = testCase;
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
|
|
||||||
OkHttpChannelBuilder channelBuilder = OkHttpChannelBuilder.forAddress(host, port);
|
ManagedChannelBuilder channelBuilder = ManagedChannelBuilder.forAddress(host, port);
|
||||||
if (serverHostOverride != null) {
|
if (serverHostOverride != null) {
|
||||||
// Force the hostname to match the cert the server uses.
|
// Force the hostname to match the cert the server uses.
|
||||||
channelBuilder.overrideAuthority(serverHostOverride);
|
channelBuilder.overrideAuthority(serverHostOverride);
|
||||||
|
|
@ -146,13 +147,13 @@ public final class InteropTester extends AsyncTask<Void, Void, String> {
|
||||||
} else {
|
} else {
|
||||||
factory = getSslSocketFactory(testCa);
|
factory = getSslSocketFactory(testCa);
|
||||||
}
|
}
|
||||||
channelBuilder.negotiationType(NegotiationType.TLS);
|
((OkHttpChannelBuilder) channelBuilder).negotiationType(NegotiationType.TLS);
|
||||||
channelBuilder.sslSocketFactory(factory);
|
((OkHttpChannelBuilder) channelBuilder).sslSocketFactory(factory);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
channelBuilder.negotiationType(NegotiationType.PLAINTEXT);
|
channelBuilder.usePlaintext(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
channel = channelBuilder.build();
|
channel = channelBuilder.build();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue