@Test public void testRetryMethod() { GobblinHttpMethodRetryHandler gobblinHttpMethodRetryHandler = new GobblinHttpMethodRetryHandler(1, false); HttpMethod mockHttpMethod = Mockito.mock(HttpMethod.class); Assert.assertTrue(gobblinHttpMethodRetryHandler.retryMethod(mockHttpMethod, new UnknownHostException("dummyException"), 0)); Assert.assertTrue(gobblinHttpMethodRetryHandler.retryMethod(mockHttpMethod, new UnknownHostException("dummyException"), 1)); Assert.assertFalse(gobblinHttpMethodRetryHandler.retryMethod(mockHttpMethod, new UnknownHostException("dummyException"), 2)); DefaultHttpMethodRetryHandler defaultHttpMethodRetryHandler = new DefaultHttpMethodRetryHandler(1, false); boolean shouldRetryWithGobblinRetryHandler = gobblinHttpMethodRetryHandler.retryMethod(mockHttpMethod, new IOException("dummyException"), 0); boolean shouldRetryWithDefaultRetryHandler = defaultHttpMethodRetryHandler.retryMethod(mockHttpMethod, new IOException("dummyException"), 0); Assert.assertTrue(shouldRetryWithGobblinRetryHandler); Assert.assertEquals(shouldRetryWithDefaultRetryHandler, shouldRetryWithGobblinRetryHandler); shouldRetryWithGobblinRetryHandler = gobblinHttpMethodRetryHandler.retryMethod(mockHttpMethod, new IOException("dummyException"), 2); shouldRetryWithDefaultRetryHandler = defaultHttpMethodRetryHandler.retryMethod(mockHttpMethod, new IOException("dummyException"), 2); Assert.assertFalse(shouldRetryWithGobblinRetryHandler); Assert.assertEquals(shouldRetryWithDefaultRetryHandler, shouldRetryWithGobblinRetryHandler); }
@Override public boolean retryMethod(final HttpMethod method, final IOException exception, int executionCount) { if (method == null) { throw new IllegalArgumentException("HTTP method may not be null"); } if (exception == null) { throw new IllegalArgumentException("Exception parameter may not be null"); } if (executionCount > super.getRetryCount()) { return false; } if (exception instanceof UnknownHostException || exception instanceof NoRouteToHostException) { return true; } return super.retryMethod(method, exception, executionCount); }
GobblinHttpMethodRetryHandler extends DefaultHttpMethodRetryHandler { @Override public boolean retryMethod(final HttpMethod method, final IOException exception, int executionCount) { if (method == null) { throw new IllegalArgumentException("HTTP method may not be null"); } if (exception == null) { throw new IllegalArgumentException("Exception parameter may not be null"); } if (executionCount > super.getRetryCount()) { return false; } if (exception instanceof UnknownHostException || exception instanceof NoRouteToHostException) { return true; } return super.retryMethod(method, exception, executionCount); } }
GobblinHttpMethodRetryHandler extends DefaultHttpMethodRetryHandler { @Override public boolean retryMethod(final HttpMethod method, final IOException exception, int executionCount) { if (method == null) { throw new IllegalArgumentException("HTTP method may not be null"); } if (exception == null) { throw new IllegalArgumentException("Exception parameter may not be null"); } if (executionCount > super.getRetryCount()) { return false; } if (exception instanceof UnknownHostException || exception instanceof NoRouteToHostException) { return true; } return super.retryMethod(method, exception, executionCount); } GobblinHttpMethodRetryHandler();  GobblinHttpMethodRetryHandler(int retryCount, boolean requestSentRetryEnabled); }
GobblinHttpMethodRetryHandler extends DefaultHttpMethodRetryHandler { @Override public boolean retryMethod(final HttpMethod method, final IOException exception, int executionCount) { if (method == null) { throw new IllegalArgumentException("HTTP method may not be null"); } if (exception == null) { throw new IllegalArgumentException("Exception parameter may not be null"); } if (executionCount > super.getRetryCount()) { return false; } if (exception instanceof UnknownHostException || exception instanceof NoRouteToHostException) { return true; } return super.retryMethod(method, exception, executionCount); } GobblinHttpMethodRetryHandler();  GobblinHttpMethodRetryHandler(int retryCount, boolean requestSentRetryEnabled); @Override boolean retryMethod(final HttpMethod method, final IOException exception, int executionCount); }
GobblinHttpMethodRetryHandler extends DefaultHttpMethodRetryHandler { @Override public boolean retryMethod(final HttpMethod method, final IOException exception, int executionCount) { if (method == null) { throw new IllegalArgumentException("HTTP method may not be null"); } if (exception == null) { throw new IllegalArgumentException("Exception parameter may not be null"); } if (executionCount > super.getRetryCount()) { return false; } if (exception instanceof UnknownHostException || exception instanceof NoRouteToHostException) { return true; } return super.retryMethod(method, exception, executionCount); } GobblinHttpMethodRetryHandler();  GobblinHttpMethodRetryHandler(int retryCount, boolean requestSentRetryEnabled); @Override boolean retryMethod(final HttpMethod method, final IOException exception, int executionCount);  }