@Test public void testInterceptClientCall_ZeroBuffer() { MethodDescriptor<Object, Object> method = buildMethod(MethodDescriptor.MethodType.BIDI_STREAMING); GrpcBufferingInterceptor testSubject = new GrpcBufferingInterceptor(0); ClientCall<Object, Object> actual = testSubject.interceptCall(method, mockCallOptions, mockChannel); verify(mockChannel).newCall(method, mockCallOptions); actual.start(mockResponseListener, null); verify(mockCall, never()).request(anyInt()); }
@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);  }