mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-27 21:29:12 +00:00
Don't retry a request for NoRouteToHostException
This commit is contained in:
parent
5164a4e7b4
commit
755b69ea3c
@ -30,6 +30,7 @@
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.NoRouteToHostException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -106,6 +107,7 @@ protected DefaultHttpRequestRetryStrategy(
|
||||
* <li>UnknownHostException</li>
|
||||
* <li>ConnectException</li>
|
||||
* <li>ConnectionClosedException</li>
|
||||
* <li>NoRouteToHostException</li>
|
||||
* <li>SSLException</li>
|
||||
* </ul>
|
||||
*
|
||||
@ -129,6 +131,7 @@ public DefaultHttpRequestRetryStrategy(
|
||||
UnknownHostException.class,
|
||||
ConnectException.class,
|
||||
ConnectionClosedException.class,
|
||||
NoRouteToHostException.class,
|
||||
SSLException.class),
|
||||
Arrays.asList(
|
||||
HttpStatus.SC_TOO_MANY_REQUESTS,
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.NoRouteToHostException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Date;
|
||||
@ -126,6 +127,13 @@ public void noRetryOnConnectionClosed() throws Exception {
|
||||
Assert.assertFalse(retryStrategy.retryRequest(request, new ConnectionClosedException(), 1, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noRetryForNoRouteToHostException() {
|
||||
final HttpGet request = new HttpGet("/");
|
||||
|
||||
Assert.assertFalse(retryStrategy.retryRequest(request, new NoRouteToHostException(), 1, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noRetryOnSSLFailure() throws Exception {
|
||||
final HttpGet request = new HttpGet("/");
|
||||
|
Loading…
x
Reference in New Issue
Block a user