use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project grpc-java by grpc.
the class AbstractTransportTest method authorityPropagation.
@Test
@SuppressWarnings("deprecation")
public void authorityPropagation() throws Exception {
server.start(serverListener);
client = newClientTransport(server);
runIfNotNull(client.start(mockClientTransportListener));
MockServerTransportListener serverTransportListener = serverListener.takeListenerOrFail(TIMEOUT_MS, TimeUnit.MILLISECONDS);
Metadata clientHeaders = new Metadata();
ClientStream clientStream = client.newStream(methodDescriptor, clientHeaders);
clientStream.start(mockClientStreamListener);
StreamCreation serverStreamCreation = serverTransportListener.takeStreamOrFail(TIMEOUT_MS, TimeUnit.MILLISECONDS);
ServerStream serverStream = serverStreamCreation.stream;
assertEquals(testAuthority(server), serverStream.getAuthority());
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project grpc-java by grpc.
the class ServerCallsTest method disablingInboundAutoFlowControlForUnaryHasNoEffect.
@Test
public void disablingInboundAutoFlowControlForUnaryHasNoEffect() throws Exception {
ServerCallHandler<Integer, Integer> callHandler = ServerCalls.asyncUnaryCall(new ServerCalls.UnaryMethod<Integer, Integer>() {
@Override
public void invoke(Integer req, StreamObserver<Integer> responseObserver) {
ServerCallStreamObserver<Integer> serverCallObserver = (ServerCallStreamObserver<Integer>) responseObserver;
serverCallObserver.disableAutoInboundFlowControl();
}
});
callHandler.startCall(serverCall, new Metadata());
// Auto inbound flow-control always requests 2 messages for unary to detect a violation
// of the unary semantic.
assertThat(serverCall.requestCalls).containsExactly(2);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project sonarlint-core by SonarSource.
the class StandaloneDaemonTest method shutdown.
@After
public void shutdown() throws Exception {
ClientCall<Void, Void> call = channel.newCall(StandaloneSonarLintGrpc.METHOD_SHUTDOWN, CallOptions.DEFAULT);
call.start(new Listener<Void>() {
}, new Metadata());
call.sendMessage(Void.newBuilder().build());
call.halfClose();
call.request(1);
channel.shutdownNow();
channel.awaitTermination(2, TimeUnit.SECONDS);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project sonarlint-core by SonarSource.
the class StandaloneDaemonTest method getLogs.
private ClientCall<Void, LogEvent> getLogs(LogCollector collector, Channel channel) {
ClientCall<Void, LogEvent> call = channel.newCall(StandaloneSonarLintGrpc.METHOD_STREAM_LOGS, CallOptions.DEFAULT);
call.start(collector, new Metadata());
call.sendMessage(Void.newBuilder().build());
call.halfClose();
call.request(Integer.MAX_VALUE);
return call;
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project sonarlint-core by SonarSource.
the class ExceptionInterceptorTest method testInterceptor.
@Test
public void testInterceptor() {
ExceptionInterceptor interceptor = new ExceptionInterceptor();
ServerCall<Void, Void> call = mock(ServerCall.class);
Metadata headers = new Metadata();
ServerCallHandler<Void, Void> next = mock(ServerCallHandler.class);
interceptor.interceptCall(call, headers, next);
verify(next).startCall(isA(TransformStatusServerCall.class), eq(headers));
}
Aggregations