@Test public void clientSendsOne_errorTooManyRequests_unary() { ServerCallRecorder serverCall = new ServerCallRecorder(UNARY_METHOD); ServerCallHandler<Integer, Integer> callHandler = ServerCalls.asyncUnaryCall( new ServerCalls.UnaryMethod<Integer, Integer>() { @Override public void invoke(Integer req, StreamObserver<Integer> responseObserver) { fail("should not be reached"); } }); ServerCall.Listener<Integer> listener = callHandler.startCall(serverCall, new Metadata()); listener.onMessage(1); listener.onMessage(1); assertThat(serverCall.responses).isEmpty(); assertEquals(Status.Code.INTERNAL, serverCall.status.getCode()); assertEquals(ServerCalls.TOO_MANY_REQUESTS, serverCall.status.getDescription()); listener.onHalfClose(); }
public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncUnaryCall( UnaryMethod<ReqT, RespT> method) { return asyncUnaryRequestCall(method); }
ServerCalls { public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncUnaryCall( UnaryMethod<ReqT, RespT> method) { return asyncUnaryRequestCall(method); } }
ServerCalls { public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncUnaryCall( UnaryMethod<ReqT, RespT> method) { return asyncUnaryRequestCall(method); } private  ServerCalls(); }
ServerCalls { public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncUnaryCall( UnaryMethod<ReqT, RespT> method) { return asyncUnaryRequestCall(method); } private  ServerCalls(); static ServerCallHandler<ReqT, RespT> asyncUnaryCall(
      UnaryMethod<ReqT, RespT> method); static ServerCallHandler<ReqT, RespT> asyncServerStreamingCall(
      ServerStreamingMethod<ReqT, RespT> method); static ServerCallHandler<ReqT, RespT> asyncClientStreamingCall(
      ClientStreamingMethod<ReqT, RespT> method); static ServerCallHandler<ReqT, RespT> asyncBidiStreamingCall(
      BidiStreamingMethod<ReqT, RespT> method); static void asyncUnimplementedUnaryCall(
      MethodDescriptor<?, ?> methodDescriptor, StreamObserver<?> responseObserver); static StreamObserver<T> asyncUnimplementedStreamingCall(
      MethodDescriptor<?, ?> methodDescriptor, StreamObserver<?> responseObserver); }
ServerCalls { public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncUnaryCall( UnaryMethod<ReqT, RespT> method) { return asyncUnaryRequestCall(method); } private  ServerCalls(); static ServerCallHandler<ReqT, RespT> asyncUnaryCall(
      UnaryMethod<ReqT, RespT> method); static ServerCallHandler<ReqT, RespT> asyncServerStreamingCall(
      ServerStreamingMethod<ReqT, RespT> method); static ServerCallHandler<ReqT, RespT> asyncClientStreamingCall(
      ClientStreamingMethod<ReqT, RespT> method); static ServerCallHandler<ReqT, RespT> asyncBidiStreamingCall(
      BidiStreamingMethod<ReqT, RespT> method); static void asyncUnimplementedUnaryCall(
      MethodDescriptor<?, ?> methodDescriptor, StreamObserver<?> responseObserver); static StreamObserver<T> asyncUnimplementedStreamingCall(
      MethodDescriptor<?, ?> methodDescriptor, StreamObserver<?> responseObserver);  }