CH-1128: Implement maximum retry count and update tests.