Skip to content

Instantly share code, notes, and snippets.

@jfarcand
Created September 28, 2010 21:42
Show Gist options
  • Save jfarcand/601846 to your computer and use it in GitHub Desktop.
Save jfarcand/601846 to your computer and use it in GitHub Desktop.
diff --git a/src/main/java/com/ning/http/client/providers/NettyAsyncHttpProvider.java b/src/main/java/com/ning/http/client/providers/NettyAsyncHtindex 7572c92..ca48446 100644
--- a/src/main/java/com/ning/http/client/providers/NettyAsyncHttpProvider.java
+++ b/src/main/java/com/ning/http/client/providers/NettyAsyncHttpProvider.java
@@ -942,7 +942,7 @@ public class NettyAsyncHttpProvider extends IdleStateHandler implements AsyncHtt
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
- Channel ch = e.getChannel();
+ Channel channel = e.getChannel();
Throwable cause = e.getCause();
if (log.isDebugEnabled()) {
@@ -957,6 +957,24 @@ public class NettyAsyncHttpProvider extends IdleStateHandler implements AsyncHtt
return;
}
+ if (cause != null && cause.getMessage() != null
+ && cause.getMessage().equals("An established connection was aborted by the software in your host machine")) {
+ if (log.isDebugEnabled()) {
+ log.debug(cause);
+ }
+
+ NettyResponseFuture<?> f = (NettyResponseFuture<?>)
+ channel.getPipeline().getContext(NettyAsyncHttpProvider.class).getAttachment();
+
+ try {
+ f.provider().execute(f.getRequest(),f);
+ } catch (IOException ioe) {
+ f.abort(ioe);
+ log.error(ioe);
+ }
+ return;
+ }
+
if (future != null) {
try {
future.abort(cause);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment