File tree Expand file tree Collapse file tree 5 files changed +16
-4
lines changed
main/java/org/asynchttpclient
test/java/org/asynchttpclient/async
grizzly/src/main/java/org/asynchttpclient/providers/grizzly
netty/src/main/java/org/asynchttpclient/providers/netty/handler Expand file tree Collapse file tree 5 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 20
20
import org .asynchttpclient .filter .FilterException ;
21
21
import org .asynchttpclient .filter .RequestFilter ;
22
22
import org .asynchttpclient .resumable .ResumableAsyncHandler ;
23
+
23
24
import java .io .Closeable ;
25
+
24
26
import org .slf4j .Logger ;
25
27
import org .slf4j .LoggerFactory ;
26
28
Original file line number Diff line number Diff line change 14
14
15
15
import java .io .ByteArrayInputStream ;
16
16
import java .io .FileNotFoundException ;
17
+ import java .io .IOException ;
17
18
import java .io .InputStream ;
18
19
import java .io .SequenceInputStream ;
19
20
import java .io .UnsupportedEncodingException ;
52
53
* The cookies's handling code is from the Netty framework.
53
54
*/
54
55
public class AsyncHttpProviderUtils {
55
-
56
+
57
+ public static final IOException REMOTELY_CLOSED_EXCEPTION = new IOException ("Remotely Closed" );
58
+
59
+ static {
60
+ REMOTELY_CLOSED_EXCEPTION .setStackTrace (new StackTraceElement [] {});
61
+ }
62
+
56
63
private final static byte [] NO_BYTES = new byte [0 ];
57
64
58
65
public final static String DEFAULT_CHARSET = "ISO-8859-1" ;
Original file line number Diff line number Diff line change 28
28
import org .asynchttpclient .AsyncHttpClientConfig ;
29
29
import org .asynchttpclient .Realm ;
30
30
import org .asynchttpclient .Response ;
31
+ import org .asynchttpclient .util .AsyncHttpProviderUtils ;
31
32
import org .eclipse .jetty .server .Request ;
32
33
import org .eclipse .jetty .server .Server ;
33
34
import org .eclipse .jetty .server .handler .AbstractHandler ;
@@ -195,7 +196,7 @@ public void digestFuturePreemptiveAuthTimeoutTest() throws Exception {
195
196
protected void inspectException (Throwable t ) {
196
197
assertNotNull (t .getCause ());
197
198
assertEquals (t .getCause ().getClass (), IOException .class );
198
- if (! t .getCause (). getMessage (). startsWith ( "Remotely Closed" ) ) {
199
+ if (t .getCause () != AsyncHttpProviderUtils . REMOTELY_CLOSED_EXCEPTION ) {
199
200
fail ();
200
201
}
201
202
}
Original file line number Diff line number Diff line change 17
17
import org .asynchttpclient .Request ;
18
18
import org .asynchttpclient .providers .grizzly .bodyhandler .BodyHandler ;
19
19
import org .asynchttpclient .providers .grizzly .statushandler .StatusHandler ;
20
+ import org .asynchttpclient .util .AsyncHttpProviderUtils ;
20
21
import org .asynchttpclient .websocket .WebSocket ;
21
22
import org .glassfish .grizzly .CloseListener ;
22
23
import org .glassfish .grizzly .CloseType ;
@@ -67,7 +68,7 @@ public final class HttpTxContext {
67
68
public void onClosed (Closeable closeable , CloseType type )
68
69
throws IOException {
69
70
if (CloseType .REMOTELY .equals (type )) {
70
- abort (new IOException ( "Remotely Closed" ) );
71
+ abort (AsyncHttpProviderUtils . REMOTELY_CLOSED_EXCEPTION );
71
72
}
72
73
}
73
74
};
Original file line number Diff line number Diff line change 35
35
import org .asynchttpclient .providers .netty .future .NettyResponseFuture ;
36
36
import org .asynchttpclient .providers .netty .future .NettyResponseFutures ;
37
37
import org .asynchttpclient .providers .netty .request .NettyRequestSender ;
38
+ import org .asynchttpclient .util .AsyncHttpProviderUtils ;
38
39
import org .slf4j .Logger ;
39
40
import org .slf4j .LoggerFactory ;
40
41
@@ -119,7 +120,7 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
119
120
120
121
if (future != null && !future .isDone () && !future .isCancelled ()) {
121
122
if (!requestSender .retry (ctx .channel (), future )) {
122
- channels .abort (future , new IOException ( "Remotely Closed" ) );
123
+ channels .abort (future , AsyncHttpProviderUtils . REMOTELY_CLOSED_EXCEPTION );
123
124
}
124
125
} else {
125
126
channels .closeChannel (ctx );
You can’t perform that action at this time.
0 commit comments