@Test public void testInterceptServerCall_BiDiStreaming() { MethodDescriptor<Object, Object> method = buildMethod(MethodDescriptor.MethodType.BIDI_STREAMING); when(mockServerCall.getMethodDescriptor()).thenReturn(method); GrpcBufferingInterceptor testSubject = new GrpcBufferingInterceptor(1000); testSubject.interceptCall(mockServerCall, mockMetaData, mockServerCallHandler); InOrder inOrder = inOrder(mockServerCallHandler, mockServerCall); inOrder.verify(mockServerCallHandler).startCall(mockServerCall, mockMetaData); inOrder.verify(mockServerCall).request(1000); }
@Override public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) { ClientCall<ReqT, RespT> call = next.newCall(method, callOptions); if (additionalBuffer <= 0 || method.getType().serverSendsOneMessage()) { return call; } return new AdditionalMessageRequestingCall<>(call, additionalBuffer); }
GrpcBufferingInterceptor implements ClientInterceptor, ServerInterceptor { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) { ClientCall<ReqT, RespT> call = next.newCall(method, callOptions); if (additionalBuffer <= 0 || method.getType().serverSendsOneMessage()) { return call; } return new AdditionalMessageRequestingCall<>(call, additionalBuffer); } }
GrpcBufferingInterceptor implements ClientInterceptor, ServerInterceptor { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) { ClientCall<ReqT, RespT> call = next.newCall(method, callOptions); if (additionalBuffer <= 0 || method.getType().serverSendsOneMessage()) { return call; } return new AdditionalMessageRequestingCall<>(call, additionalBuffer); } GrpcBufferingInterceptor(int additionalBuffer); }
GrpcBufferingInterceptor implements ClientInterceptor, ServerInterceptor { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) { ClientCall<ReqT, RespT> call = next.newCall(method, callOptions); if (additionalBuffer <= 0 || method.getType().serverSendsOneMessage()) { return call; } return new AdditionalMessageRequestingCall<>(call, additionalBuffer); } GrpcBufferingInterceptor(int additionalBuffer); @Override ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next); @Override ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next); }
GrpcBufferingInterceptor implements ClientInterceptor, ServerInterceptor { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) { ClientCall<ReqT, RespT> call = next.newCall(method, callOptions); if (additionalBuffer <= 0 || method.getType().serverSendsOneMessage()) { return call; } return new AdditionalMessageRequestingCall<>(call, additionalBuffer); } GrpcBufferingInterceptor(int additionalBuffer); @Override ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next); @Override ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next);  }