@Override
    public Optional<ServiceInstance> select(String serviceName, PolicyContext policyContext) {
        final ServiceInstance lastInstance = policyContext.getServiceInstance();
        return DiscoveryManager.INSTANCE.choose(serviceName, lbCache.computeIfAbsent(serviceName,
            name -> new RoundRobinLoadbalancer()), (serviceName1, serviceInstances) -> {
                if (serviceInstances == null || serviceInstances.size() <= 1) {
                    return serviceInstances;
                }
                serviceInstances.removeIf(instance -> instance.equals(lastInstance));
                return serviceInstances;
            });
    }
@Test
    public void select() {
        String serviceName = "test";
        final ServiceInstance selectedInstance = CommonUtils.buildInstance(serviceName, 8989);
        final ServiceInstance nextInstance = CommonUtils.buildInstance(serviceName, 8888);
        final List<ServiceInstance> serviceInstances = Arrays.asList(selectedInstance, nextInstance);
        try {
            Mockito.when(zkService34.getInstances(serviceName)).thenReturn(serviceInstances);
        } catch (QueryInstanceException e) {
            e.printStackTrace();
        }
        final RoundRobinRetryPolicy roundRobinRetryPolicy = new RoundRobinRetryPolicy();
        final PolicyContext policyContext = new PolicyContext();
        policyContext.setServiceInstance(selectedInstance);
        final Optional<ServiceInstance> select = roundRobinRetryPolicy.select(serviceName, policyContext);
        Assert.assertTrue(select.isPresent());
        Assert.assertEquals(select.get(), nextInstance);
    }