@Override
    public List<AwsEndpoint> getClusterEndpoints() {
        List<AwsEndpoint> result = new ArrayList<>();

        Applications applications = applicationsSource.getApplications(
                transportConfig.getApplicationsResolverDataStalenessThresholdSeconds(), TimeUnit.SECONDS);

        if (applications != null && vipAddress != null) {
            List<InstanceInfo> validInstanceInfos = applications.getInstancesByVirtualHostName(vipAddress);
            for (InstanceInfo instanceInfo : validInstanceInfos) {
                if (instanceInfo.getStatus() == InstanceInfo.InstanceStatus.UP) {
                    AwsEndpoint endpoint = ResolverUtils.instanceInfoToEndpoint(clientConfig, transportConfig, instanceInfo);
                    if (endpoint != null) {
                        result.add(endpoint);
                    }
                }
            }
        }

        logger.debug("Retrieved endpoint list {}", result);
        return result;

    }
@Test
    public void testStaleData() {
        when(applicationsSource.getApplications(anyInt(), eq(TimeUnit.SECONDS))).thenReturn(null);  // stale contract

        List<AwsEndpoint> endpoints = resolver.getClusterEndpoints();
        assertThat(endpoints.isEmpty(), is(true));
    }