@Override
    public List<AwsEndpoint> getClusterEndpoints() {
        List<AwsEndpoint>[] parts = ResolverUtils.splitByZone(delegate.getClusterEndpoints(), myZone);
        List<AwsEndpoint> myZoneEndpoints = parts[0];
        List<AwsEndpoint> remainingEndpoints = parts[1];
        List<AwsEndpoint> randomizedList = randomizeAndMerge(myZoneEndpoints, remainingEndpoints);
        if (!zoneAffinity) {
            Collections.reverse(randomizedList);
        }

        logger.debug("Local zone={}; resolved to: {}", myZone, randomizedList);

        return randomizedList;
    }
@Test
    public void testApplicationZoneIsFirstOnTheList() throws Exception {
        List<AwsEndpoint> endpoints = SampleCluster.merge(SampleCluster.UsEast1a, SampleCluster.UsEast1b, SampleCluster.UsEast1c);

        ZoneAffinityClusterResolver resolver = new ZoneAffinityClusterResolver(
                new StaticClusterResolver<>("regionA", endpoints),
                "us-east-1b",
                true,
                ResolverUtils::randomize);
        List<AwsEndpoint> result = resolver.getClusterEndpoints();
        assertThat(result.size(), is(equalTo(endpoints.size())));
        assertThat(result.get(0).getZone(), is(equalTo("us-east-1b")));
    }