private SimpleRetryExceptionHandler getHandlerAfterRetry(RetryPolicy retryPolicy, RuntimeException ex,
Collection<Class<? extends Throwable>> fatalExceptions) {
// Always rethrow if the retry is exhausted
SimpleRetryExceptionHandler handler = new SimpleRetryExceptionHandler(retryPolicy,
new SimpleLimitExceptionHandler(0), fatalExceptions);
// Simulate a failed retry...
RetryContext retryContext = retryPolicy.open(null);
retryPolicy.registerThrowable(retryContext, ex);
handler.close(retryContext, null, ex);