use of io.servicetalk.grpc.netty.CompatProto.Compat.CompatClient in project servicetalk by apple.
the class ProtocolCompatibilityTest method serviceTalkToServiceTalkCompressionError.
@ParameterizedTest
@MethodSource("sslAndStreamingParams")
void serviceTalkToServiceTalkCompressionError(final boolean ssl, final boolean streaming) throws Exception {
final String clientCompression = "gzip";
final TestServerContext server = serviceTalkServer(ErrorMode.NONE, ssl, null, null);
final CompatClient client = serviceTalkClient(server.listenAddress(), ssl, clientCompression, null);
testGrpcError(client, server, false, streaming, clientCompression, GrpcStatusCode.UNIMPLEMENTED, null);
}
use of io.servicetalk.grpc.netty.CompatProto.Compat.CompatClient in project servicetalk by apple.
the class ProtocolCompatibilityTest method serviceTalkToServiceTalkErrorViaServerFilter.
@ParameterizedTest
@MethodSource("sslStreamingAndCompressionParams")
void serviceTalkToServiceTalkErrorViaServerFilter(final boolean ssl, final boolean streaming, final String compression) throws Exception {
final TestServerContext server = serviceTalkServer(ErrorMode.SIMPLE_IN_SERVER_FILTER, ssl, compression, null);
final CompatClient client = serviceTalkClient(server.listenAddress(), ssl, compression, null);
testGrpcError(client, server, false, streaming, compression);
}
use of io.servicetalk.grpc.netty.CompatProto.Compat.CompatClient in project servicetalk by apple.
the class ProtocolCompatibilityTest method timeoutMidRequest.
@ParameterizedTest
@CsvSource({ "false,false,false", "false,false,true", "false,true,false", "false,true,true", "true,false,false", "true,false,true", "true,true,false", "true,true,true" })
void timeoutMidRequest(boolean stClient, boolean stServer, boolean clientInitiatedTimeout) throws Exception {
Duration clientTimeout = clientInitiatedTimeout ? DEFAULT_DEADLINE : null;
Duration serverTimeout = clientInitiatedTimeout ? null : DEFAULT_DEADLINE;
BlockingQueue<Throwable> serverErrorQueue = new ArrayBlockingQueue<>(16);
final TestServerContext server = stServer ? serviceTalkServer(ErrorMode.NONE, false, offloadNever(), null, null, serverErrorQueue) : grpcJavaServer(ErrorMode.NONE, false, null);
try (ServerContext proxyCtx = buildTimeoutProxy(server.listenAddress(), serverTimeout, false)) {
final CompatClient client = stClient ? serviceTalkClient(proxyCtx.listenAddress(), false, null, clientTimeout) : grpcJavaClient(proxyCtx.listenAddress(), null, false, clientTimeout);
try {
PublisherSource.Processor<CompatRequest, CompatRequest> reqPub = newPublisherProcessor();
reqPub.onNext(CompatRequest.newBuilder().setId(3).build());
validateGrpcErrorInResponse(client.bidirectionalStreamingCall(fromSource(reqPub)).toFuture(), false, clientInitiatedTimeout ? DEADLINE_EXCEEDED : CANCELLED, null);
// It is possible that the timeout on the client occurred before writing the request, in which case the
// server will never request the request, and therefore no error is expected.
Throwable cause = serverErrorQueue.poll(DEFAULT_DEADLINE.toNanos() * 2, NANOSECONDS);
if (cause != null) {
assertThat(cause, is(SERVER_PROCESSED_TOKEN));
cause = serverErrorQueue.take();
assertThat(cause, instanceOf(IOException.class));
}
} finally {
closeAll(server, client);
}
}
}
use of io.servicetalk.grpc.netty.CompatProto.Compat.CompatClient in project servicetalk by apple.
the class ProtocolCompatibilityTest method grpcJavaToServiceTalkCompressionError.
@ParameterizedTest
@MethodSource("sslAndStreamingParams")
void grpcJavaToServiceTalkCompressionError(final boolean ssl, final boolean streaming) throws Exception {
final String clientCompression = "gzip";
final TestServerContext server = serviceTalkServer(ErrorMode.NONE, ssl, null, null);
final CompatClient client = grpcJavaClient(server.listenAddress(), clientCompression, ssl, null);
testGrpcError(client, server, false, streaming, clientCompression, GrpcStatusCode.UNIMPLEMENTED, null);
}
use of io.servicetalk.grpc.netty.CompatProto.Compat.CompatClient in project servicetalk by apple.
the class ProtocolCompatibilityTest method grpcJavaToGrpcJavaClientTimeout.
@ParameterizedTest
@MethodSource("sslStreamingAndCompressionParams")
void grpcJavaToGrpcJavaClientTimeout(final boolean ssl, final boolean streaming, final String compression) throws Exception {
final TestServerContext server = grpcJavaServer(ErrorMode.NONE, ssl, compression);
try (ServerContext proxyCtx = buildTimeoutProxy(server.listenAddress(), null, ssl)) {
final CompatClient client = grpcJavaClient(proxyCtx.listenAddress(), compression, ssl, DEFAULT_DEADLINE);
testGrpcError(client, server, false, streaming, compression, DEADLINE_EXCEEDED, null);
}
}
Aggregations