@UnstableApi
    @Override
    default HttpResponse timeout(Duration timeoutDuration) {
        return timeout(timeoutDuration, StreamTimeoutMode.UNTIL_NEXT);
    }
Recovers a failed {@link HttpResponse} by switching to a returned fallback {@link HttpResponse}
when the thrown {@link Throwable} is the same type or a subtype of the
specified {@code causeClass}.

<p>Example:<pre>{@code
HttpResponse response = HttpResponse.ofFailure(new IllegalStateException("Oops..."));
// The failed HttpResponse will be recovered by the fallback function.
HttpResponse recovered =
    response.recover(IllegalStateException.class, cause -> HttpResponse.of("Fallback"));
assert recovered.aggregate().join().contentUtf8().equals("Fallback");

// As HTTP headers and body were written already before an error occurred,
// the fallback function could not be applied for the failed HttpResponse.
HttpResponseWriter response = HttpResponse.streaming();
response.write(ResponseHeaders.of(HttpStatus.OK));
response.write(HttpData.ofUtf8("Hello"));
response.close(new IllegalStateException("Oops..."));
HttpResponse notRecovered =
    response.recover(IllegalStateException.class, cause -> HttpResponse.of("Fallback"));
// The IllegalStateException will be raised even though a fallback function was added.
notRecovered.aggregate().join();

HttpResponse response = HttpResponse.ofFailure(new IllegalStateException("Oops..."));
// Use the shortcut recover method as a chain.
HttpResponse recoverChain =
    response.recover(RuntimeException.class, cause -> {
        final IllegalArgumentException ex = new IllegalArgumentException("Oops2...");
        // If a failed response is returned from the first chain
        return HttpResponse.ofFailure(ex);
    })
    // If the shortcut exception type is correct, catch and recover in the second chain.
    .recover(IllegalArgumentException.class, cause -> HttpResponse.of("fallback"));
recoverChain.aggregate().join();

HttpResponse response = HttpResponse.ofFailure(new IllegalStateException("Oops..."));
// If the exception type does not match
HttpResponse mismatchRecovered =
    response.recover(IllegalArgumentException.class, cause -> HttpResponse.of("Fallback"));
// In this case, CompletionException is thrown. (can't recover exception)
mismatchRecovered.aggregate().join();
}</pre>
core/src/main/java/com/linecorp/armeria/common/HttpResponse.java