Class StreamRecorder<T>

java.lang.Object
io.grpc.testing.StreamRecorder<T>
All Implemented Interfaces:
io.grpc.stub.StreamObserver<T>

@Deprecated @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1791") public class StreamRecorder<T> extends Object implements io.grpc.stub.StreamObserver<T>
Deprecated.
Not for public use
Utility implementation of StreamObserver used in testing. Records all the observed values produced by the stream as well as any errors.
  • Field Details

    • latch

      private final CountDownLatch latch
      Deprecated.
    • results

      private final List<T> results
      Deprecated.
    • error

      private Throwable error
      Deprecated.
    • firstValue

      private final com.google.common.util.concurrent.SettableFuture<T> firstValue
      Deprecated.
  • Constructor Details

    • StreamRecorder

      private StreamRecorder()
      Deprecated.
  • Method Details

    • create

      public static <T> StreamRecorder<T> create()
      Deprecated.
      Creates a new recorder.
    • onNext

      public void onNext(T value)
      Deprecated.
      Specified by:
      onNext in interface io.grpc.stub.StreamObserver<T>
    • onError

      public void onError(Throwable t)
      Deprecated.
      Specified by:
      onError in interface io.grpc.stub.StreamObserver<T>
    • onCompleted

      public void onCompleted()
      Deprecated.
      Specified by:
      onCompleted in interface io.grpc.stub.StreamObserver<T>
    • awaitCompletion

      public void awaitCompletion() throws Exception
      Deprecated.
      Waits for the stream to terminate.
      Throws:
      Exception
    • awaitCompletion

      public boolean awaitCompletion(int timeout, TimeUnit unit) throws Exception
      Deprecated.
      Waits a fixed timeout for the stream to terminate.
      Throws:
      Exception
    • getValues

      public List<T> getValues()
      Deprecated.
      Returns the current set of received values.
    • getError

      @Nullable public Throwable getError()
      Deprecated.
      Returns the stream terminating error.
    • firstValue

      public com.google.common.util.concurrent.ListenableFuture<T> firstValue()
      Deprecated.
      Returns a ListenableFuture for the first value received from the stream. Useful for testing unary call patterns.