Bug fix: corrected exception type thrown in case of unexpected connection termination
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
index 8ebf192..8b7fced 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
@@ -30,7 +30,6 @@
import java.io.IOException;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
-import java.nio.channels.ClosedChannelException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.WritableByteChannel;
@@ -499,7 +498,7 @@ int streamOutput(final ByteBuffer src) throws IOException {
ioSession.getLock().lock();
try {
if (outgoingMessage == null) {
- throw new ClosedChannelException();
+ throw new ConnectionClosedException();
}
final ContentEncoder contentEncoder = outgoingMessage.getBody();
final int bytesWritten = contentEncoder.write(src);