Interface NextStreamRequestProxyResponseBuilderStep<BUILDER extends BuilderStep,ReqT,RespT>

All Superinterfaces:
BuilderStep, MethodStubBuilder<ReqT,RespT>
All Known Subinterfaces:
NextBidiStreamingMethodStubBuilderStep<ReqT,RespT>, NextClientStreamingMethodResponseBuilderStep<ReqT,RespT>
All Known Implementing Classes:
BidiStreamingMethodStubBuilderImpl, ClientStreamingMethodStubBuilderImpl

public interface NextStreamRequestProxyResponseBuilderStep<BUILDER extends BuilderStep,ReqT,RespT> extends BuilderStep, MethodStubBuilder<ReqT,RespT>
Author:
Fadelis
  • Method Summary

    Modifier and Type
    Method
    Description
    nextWillProxyTo(Function<io.grpc.stub.StreamObserver<RespT>,io.grpc.stub.StreamObserver<ReqT>> streamRequestResponseProxy)
    Defines a proxying response, which will proxy the request to given Response for subsequent request call to this stub.

    Methods inherited from interface org.grpcmock.definitions.stub.steps.MethodStubBuilder

    build
  • Method Details

    • nextWillProxyTo

      BUILDER nextWillProxyTo(@Nonnull Function<io.grpc.stub.StreamObserver<RespT>,io.grpc.stub.StreamObserver<ReqT>> streamRequestResponseProxy)

      Defines a proxying response, which will proxy the request to given Response for subsequent request call to this stub. The user is responsible that the request is completed correctly.

      Should be used when there needs to be more logic in the response method than returning a simple response. For example:

       .nextWillProxyTo((responseObserver) -> new StreamObserver() {
      
          public void onNext(V value) {
            // handle incoming requests
          }
      
          public void onError(Throwable throwable) {
            // handle error;
          }
      
          public void onCompleted() {
            // send response on completion
            responseObserver.onNext(responseObject);
            responseObserver.onCompleted();
          }
       });