GrpcCallableFactory { @Deprecated @BetaApi("The surface for streaming is not stable yet and may change in the future.") public static <RequestT, ResponseT> ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, StreamingCallSettings<RequestT, ResponseT> streamingCallSettings, ClientContext clientContext) { ServerStreamingCallSettings<RequestT, ResponseT> serverStreamingCallSettings = ServerStreamingCallSettings.<RequestT, ResponseT>newBuilder().build(); return createServerStreamingCallable( grpcCallSettings, serverStreamingCallSettings, clientContext); } private  GrpcCallableFactory(); static UnaryCallable<RequestT, ResponseT> createBaseUnaryCallable(
      GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
      UnaryCallSettings<?, ?> callSettings,
      ClientContext clientContext); static UnaryCallable<RequestT, ResponseT> createUnaryCallable(
      GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
      UnaryCallSettings<RequestT, ResponseT> callSettings,
      ClientContext clientContext); static UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
          GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
          PagedCallSettings<RequestT, ResponseT, PagedListResponseT> pagedCallSettings,
          ClientContext clientContext); @BetaApi("The surface for batching is not stable yet and may change in the future.") static UnaryCallable<RequestT, ResponseT> createBatchingCallable(
      GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
      BatchingCallSettings<RequestT, ResponseT> batchingCallSettings,
      ClientContext clientContext); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") static OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
          GrpcCallSettings<RequestT, Operation> grpcCallSettings,
          OperationCallSettings<RequestT, ResponseT, MetadataT> operationCallSettings,
          ClientContext clientContext,
          OperationsStub operationsStub); @BetaApi("The surface for streaming is not stable yet and may change in the future.") static BidiStreamingCallable<RequestT, ResponseT> createBidiStreamingCallable(
          GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
          StreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
          ClientContext clientContext); @Deprecated @BetaApi("The surface for streaming is not stable yet and may change in the future.") static ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable(
          GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
          StreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
          ClientContext clientContext); @BetaApi("The surface for streaming is not stable yet and may change in the future.") static ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable(
          GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
          ServerStreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
          ClientContext clientContext); @BetaApi("The surface for streaming is not stable yet and may change in the future.") static ClientStreamingCallable<RequestT, ResponseT> createClientStreamingCallable(
          GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
          StreamingCallSettings<RequestT, ResponseT> streamingCallSettings,
          ClientContext clientContext);  }
@Test public void createServerStreamingCallableRetryableExceptions() throws Exception { GrpcCallSettings<Color, Money> grpcCallSettings = GrpcCallSettings.create(FakeServiceGrpc.METHOD_STREAMING_RECOGNIZE_ERROR); ServerStreamingCallSettings<Color, Money> nonRetryableSettings = ServerStreamingCallSettings.<Color, Money>newBuilder() .setRetrySettings( RetrySettings.newBuilder() .setTotalTimeout(Duration.ofSeconds(1)) .setMaxAttempts(1) .build()) .build(); ServerStreamingCallable<Color, Money> nonRetryableCallable = GrpcCallableFactory.createServerStreamingCallable( grpcCallSettings, nonRetryableSettings, clientContext); Throwable actualError = null; try { nonRetryableCallable .first() .call(Color.getDefaultInstance(), clientContext.getDefaultCallContext()); } catch (Throwable e) { actualError = e; } assertThat(actualError).isInstanceOf(InvalidArgumentException.class); assertThat(((InvalidArgumentException) actualError).isRetryable()).isFalse(); ServerStreamingCallSettings<Color, Money> retryableSettings = ServerStreamingCallSettings.<Color, Money>newBuilder() .setRetryableCodes(Code.INVALID_ARGUMENT) .setRetrySettings( RetrySettings.newBuilder() .setTotalTimeout(Duration.ofSeconds(1)) .setMaxAttempts(1) .build()) .build(); ServerStreamingCallable<Color, Money> retryableCallable = GrpcCallableFactory.createServerStreamingCallable( grpcCallSettings, retryableSettings, clientContext); Throwable actualError2 = null; try { retryableCallable .first() .call(Color.getDefaultInstance(), clientContext.getDefaultCallContext()); } catch (Throwable e) { actualError2 = e; } assertThat(actualError2).isInstanceOf(InvalidArgumentException.class); assertThat(((InvalidArgumentException) actualError2).isRetryable()).isTrue(); }