diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java index 3e904342b..86eff6164 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java @@ -133,7 +133,9 @@ class HttpAsyncMainClientExec implements AsyncExecChainHandler { @Override public void cancel() { - failed(new InterruptedIOException()); + if (messageCountDown.get() > 0) { + failed(new InterruptedIOException()); + } } @Override