RetryRuleBuilder extends AbstractRuleBuilder { @Override public RetryRuleBuilder onResponseTrailers( BiPredicate<? super ClientRequestContext, ? super HttpHeaders> responseTrailersFilter) { return (RetryRuleBuilder) super.onResponseTrailers(responseTrailersFilter); } RetryRuleBuilder(BiPredicate<? super ClientRequestContext, ? super RequestHeaders> requestHeadersFilter); RetryRule thenBackoff(); RetryRule thenBackoff(Backoff backoff); RetryRule thenNoRetry(); @Override RetryRuleBuilder onResponseHeaders(
            BiPredicate<? super ClientRequestContext, ? super ResponseHeaders> responseHeadersFilter); @Override RetryRuleBuilder onResponseTrailers(
            BiPredicate<? super ClientRequestContext, ? super HttpHeaders> responseTrailersFilter); @Override RetryRuleBuilder onStatusClass(HttpStatusClass... statusClasses); @Override RetryRuleBuilder onStatusClass(Iterable<HttpStatusClass> statusClasses); @Override RetryRuleBuilder onServerErrorStatus(); @Override RetryRuleBuilder onStatus(HttpStatus... statuses); @Override RetryRuleBuilder onStatus(Iterable<HttpStatus> statuses); @Override RetryRuleBuilder onStatus(
            BiPredicate<? super ClientRequestContext, ? super HttpStatus> statusFilter); @Override RetryRuleBuilder onException(Class<? extends Throwable> exception); @Override RetryRuleBuilder onException(
            BiPredicate<? super ClientRequestContext, ? super Throwable> exceptionFilter); @Override RetryRuleBuilder onException(); @Override RetryRuleBuilder onUnprocessed();  }
@Test void onResponseTrailers() { final Backoff backoff = Backoff.fixed(1000); final RetryRule rule = RetryRule.builder() .onResponseTrailers((unused, trailers) -> trailers.containsInt("grpc-status", 3)) .thenBackoff(backoff); final ClientRequestContext ctx1 = ClientRequestContext.of(HttpRequest.of(HttpMethod.GET, "/")); ctx1.logBuilder().responseTrailers(HttpHeaders.of("grpc-status", 3)); assertBackoff(rule.shouldRetry(ctx1, null)).isSameAs(backoff); final ClientRequestContext ctx2 = ClientRequestContext.of(HttpRequest.of(HttpMethod.GET, "/")); ctx2.logBuilder().responseTrailers(HttpHeaders.of("grpc-status", 0)); assertBackoff(rule.shouldRetry(ctx2, null)).isNull(); }