Skip to content

Commit b92a155

Browse files
author
Stephane Landelle
committed
Introduce a constant exception for Remotely Closed
1 parent e8abe96 commit b92a155

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/com/ning/http/client/providers/netty/NettyAsyncHttpProvider.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import com.ning.http.util.UTF8UrlEncoder;
5959
import com.ning.org.jboss.netty.handler.codec.http.CookieDecoder;
6060
import com.ning.org.jboss.netty.handler.codec.http.CookieEncoder;
61+
6162
import org.jboss.netty.bootstrap.ClientBootstrap;
6263
import org.jboss.netty.buffer.ChannelBuffer;
6364
import org.jboss.netty.buffer.ChannelBufferOutputStream;
@@ -106,6 +107,7 @@
106107
import org.slf4j.LoggerFactory;
107108

108109
import javax.net.ssl.SSLEngine;
110+
109111
import java.io.File;
110112
import java.io.FileInputStream;
111113
import java.io.IOException;
@@ -153,6 +155,10 @@
153155
import static org.jboss.netty.channel.Channels.pipeline;
154156

155157
public class NettyAsyncHttpProvider extends SimpleChannelUpstreamHandler implements AsyncHttpProvider {
158+
public static final IOException REMOTELY_CLOSED_EXCEPTION = new IOException("Remotely Closed");
159+
static {
160+
REMOTELY_CLOSED_EXCEPTION.setStackTrace(new StackTraceElement[0]);
161+
}
156162
private final static String HTTP_HANDLER = "httpHandler";
157163
protected final static String SSL_HANDLER = "sslHandler";
158164
private final static String HTTPS = "https";
@@ -1379,7 +1385,7 @@ public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws
13791385

13801386
if (future != null && !future.isDone() && !future.isCancelled()) {
13811387
if (remotelyClosed(ctx.getChannel(), future)) {
1382-
abort(future, new IOException("Remotely Closed"));
1388+
abort(future, REMOTELY_CLOSED_EXCEPTION);
13831389
}
13841390
} else {
13851391
closeChannel(ctx);

0 commit comments

Comments
 (0)