@@ -199,8 +199,8 @@ public boolean remove(Object o) {
199
199
private final Protocol webSocketProtocol = new WebSocketProtocol ();
200
200
201
201
private static boolean isNTLM (List <String > auth ) {
202
- return isNonEmpty (auth ) && auth .get (0 ).startsWith ("NTLM" );
203
- }
202
+ return isNonEmpty (auth ) && auth .get (0 ).startsWith ("NTLM" );
203
+ }
204
204
205
205
public NettyAsyncHttpProvider (AsyncHttpClientConfig config ) {
206
206
@@ -923,7 +923,7 @@ private <T> ListenableFuture<T> doConnect(final Request request, final AsyncHand
923
923
HttpRequest nettyRequest = null ;
924
924
925
925
if (f == null ) {
926
- nettyRequest = buildRequest (config , request , uri , false , bufferedBytes , proxyServer );
926
+ nettyRequest = buildRequest (config , request , uri , false , bufferedBytes , proxyServer );
927
927
f = newFuture (uri , request , asyncHandler , nettyRequest , config , this , proxyServer );
928
928
} else {
929
929
nettyRequest = buildRequest (config , request , uri , f .isConnectAllowed (), bufferedBytes , proxyServer );
@@ -1168,9 +1168,9 @@ private Realm kerberosChallenge(List<String> proxyAuth, Request request, ProxySe
1168
1168
}
1169
1169
1170
1170
private void addType3NTLMAuthorizationHeader (
1171
- List <String > auth ,
1172
- FluentCaseInsensitiveStringsMap headers ,
1173
- String username ,
1171
+ List <String > auth ,
1172
+ FluentCaseInsensitiveStringsMap headers ,
1173
+ String username ,
1174
1174
String password ,
1175
1175
String domain ,
1176
1176
String workstation ) throws NTLMEngineException {
@@ -1202,7 +1202,7 @@ private Realm ntlmChallenge(List<String> wwwAuth, Request request, ProxyServer p
1202
1202
newRealm = new Realm .RealmBuilder ().clone (realm ).setScheme (realm .getAuthScheme ()).setUri (uri .getRawPath ()).setMethodName (request .getMethod ()).setNtlmMessageType2Received (true ).build ();
1203
1203
future .getAndSetAuth (false );
1204
1204
} else {
1205
- addType3NTLMAuthorizationHeader (wwwAuth , headers , principal , password , ntlmDomain , ntlmHost );
1205
+ addType3NTLMAuthorizationHeader (wwwAuth , headers , principal , password , ntlmDomain , ntlmHost );
1206
1206
1207
1207
Realm .RealmBuilder realmBuilder ;
1208
1208
Realm .AuthScheme authScheme ;
@@ -1377,7 +1377,7 @@ public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws
1377
1377
p .onClose (ctx , e );
1378
1378
1379
1379
if (future != null && !future .isDone () && !future .isCancelled ()) {
1380
- if (! remotelyClosed (ctx .getChannel (), future )) {
1380
+ if (remotelyClosed (ctx .getChannel (), future )) {
1381
1381
abort (future , new IOException ("Remotely Closed" ));
1382
1382
}
1383
1383
} else {
@@ -1389,18 +1389,20 @@ public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws
1389
1389
protected boolean remotelyClosed (Channel channel , NettyResponseFuture <?> future ) {
1390
1390
1391
1391
if (isClose .get ()) {
1392
- return false ;
1392
+ return true ;
1393
1393
}
1394
1394
1395
1395
connectionsPool .removeAll (channel );
1396
1396
1397
- if (future == null && channel .getPipeline ().getContext (NettyAsyncHttpProvider .class ).getAttachment () instanceof NettyResponseFuture ) {
1398
- future = (NettyResponseFuture <?>) channel .getPipeline ().getContext (NettyAsyncHttpProvider .class ).getAttachment ();
1397
+ if (future == null ) {
1398
+ Object attachment = channel .getPipeline ().getContext (NettyAsyncHttpProvider .class ).getAttachment ();
1399
+ if (attachment instanceof NettyResponseFuture )
1400
+ future = (NettyResponseFuture <?>) attachment ;
1399
1401
}
1400
1402
1401
1403
if (future == null || future .cannotBeReplay ()) {
1402
1404
log .debug ("Unable to recover future {}\n " , future );
1403
- return false ;
1405
+ return true ;
1404
1406
}
1405
1407
1406
1408
future .setState (NettyResponseFuture .STATE .RECONNECTED );
@@ -1409,13 +1411,13 @@ protected boolean remotelyClosed(Channel channel, NettyResponseFuture<?> future)
1409
1411
1410
1412
try {
1411
1413
nextRequest (future .getRequest (), future );
1412
- return true ;
1414
+ return false ;
1413
1415
} catch (IOException iox ) {
1414
1416
future .setState (NettyResponseFuture .STATE .CLOSED );
1415
1417
future .abort (iox );
1416
1418
log .error ("Remotely Closed, unable to recover" , iox );
1419
+ return true ;
1417
1420
}
1418
- return false ;
1419
1421
}
1420
1422
1421
1423
private void markAsDone (final NettyResponseFuture <?> future , final ChannelHandlerContext ctx ) throws MalformedURLException {
0 commit comments