private void handleStreamingResponse(RetryConfig<HttpResponse> retryConfig, ClientRequestContext ctx,
                                         HttpRequestDuplicator rootReqDuplicator,
                                         HttpRequest originalReq, HttpResponse returnedRes,
                                         CompletableFuture<HttpResponse> future,
                                         ClientRequestContext derivedCtx,
                                         HttpResponse response) {
        final SplitHttpResponse splitResponse = response.split();
        splitResponse.headers().handle((headers, headersCause) -> {
            final Throwable responseCause;
            if (headersCause == null) {
                final RequestLog log = derivedCtx.log().getIfAvailable(RequestLogProperty.RESPONSE_CAUSE);
                responseCause = log != null ? log.responseCause() : null;
            } else {
                responseCause = Exceptions.peel(headersCause);
            }
            completeLogIfBytesNotTransferred(response, headers, derivedCtx, responseCause);

            derivedCtx.log().whenAvailable(RequestLogProperty.RESPONSE_HEADERS).thenRun(() -> {
                if (retryConfig.needsContentInRule() && responseCause == null) {
                    final HttpResponse response0 = splitResponse.unsplit();
                    final HttpResponseDuplicator duplicator =
                            response0.toDuplicator(derivedCtx.eventLoop().withoutContext(),
                                                   derivedCtx.maxResponseLength());
                    try {
                        final TruncatingHttpResponse truncatingHttpResponse =
                                new TruncatingHttpResponse(duplicator.duplicate(),
                                                           retryConfig.maxContentLength());
                        final HttpResponse duplicated = duplicator.duplicate();
                        duplicator.close();

                        final RetryRuleWithContent<HttpResponse> ruleWithContent =
                                retryConfig.retryRuleWithContent();
                        assert ruleWithContent != null;
                        ruleWithContent.shouldRetry(derivedCtx, truncatingHttpResponse, null)
                                       .handle((decision, cause) -> {
                                           warnIfExceptionIsRaised(ruleWithContent, cause);
                                           truncatingHttpResponse.abort();
                                           handleRetryDecision(decision, ctx, derivedCtx, rootReqDuplicator,
                                                               originalReq, returnedRes, future, duplicated);
                                           return null;
                                       });
                    } catch (Throwable cause) {
                        duplicator.abort(cause);
                        handleException(ctx, rootReqDuplicator, future, cause, false);
                    }
                } else {
                    final HttpResponse response0;
                    if (responseCause != null) {
                        splitResponse.body().abort(responseCause);
                        response0 = HttpResponse.ofFailure(responseCause);
                    } else {
                        response0 = splitResponse.unsplit();
                    }
                    handleResponseWithoutContent(retryConfig, ctx, rootReqDuplicator, originalReq, returnedRes,
                                                 future, derivedCtx, response0, responseCause);
                }
            });
            return null;
        });
    }
Creates a new instance that decorates the specified {@link HttpClient}.
core/src/main/java/com/linecorp/armeria/client/retry/RetryingClient.java