Skip to content

Commit 85e26c9

Browse files
author
Stephane Landelle
committed
Track strangely closed channels
1 parent 5926202 commit 85e26c9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

providers/netty4/src/test/java/org/asynchttpclient/providers/netty4/NettyBasicHttpsPureNettyTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import java.net.ServerSocket;
4141
import java.net.URI;
4242
import java.net.URL;
43+
import java.nio.channels.ClosedChannelException;
4344
import java.security.GeneralSecurityException;
4445
import java.security.KeyStore;
4546
import java.security.SecureRandom;
@@ -357,6 +358,17 @@ public void channelRead(final ChannelHandlerContext ctx, Object e) throws Except
357358
}
358359
}
359360
}
361+
362+
@Override
363+
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
364+
365+
ResponseFuture responseFuture = responseFutureAttr(ctx.pipeline()).get();
366+
if (responseFuture != null) {
367+
responseFuture.set(new RuntimeException("How come the channel was closed?!, How can I properly trap this upstream?"));
368+
}
369+
370+
ctx.fireChannelInactive();
371+
}
360372

361373
@Override
362374
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {

0 commit comments

Comments
 (0)