RestOperationsRetryPolicy extends AbstractRetryPolicy implements RetryPolicy { @Override public boolean retry(Throwable e) { if (e instanceof ResourceAccessException) { return true; } if (e instanceof HttpServerErrorException) { HttpStatus statusCode = ((HttpServerErrorException) e).getStatusCode(); if (statusCode == HttpStatus.BAD_GATEWAY) { return true; } } return false; } RestOperationsRetryPolicy();  RestOperationsRetryPolicy(int retryInterval); @Override boolean retry(Throwable e);  }
@Test public void testRetryJudgement() throws InterruptedException { assertEquals(true, policy.retry(new ResourceAccessException(null))); assertEquals(false, policy.retry(new IOException())); }