@Override
    protected Upstream doSelect(final List<Upstream> upstreamList, final String ip) {
        Map<String, Upstream> domainMap = upstreamList.stream()
                .collect(Collectors.toConcurrentMap(Upstream::buildDomain, upstream -> upstream));

        domainMap.keySet().stream()
                .filter(key -> !countMap.containsKey(key))
                .forEach(domain -> countMap.put(domain, Long.MIN_VALUE));

        final String domain = countMap.entrySet().stream()
                // Ensure that the filtered domain is included in the domainMap.
                .filter(entry -> domainMap.containsKey(entry.getKey()))
                .min(Comparator.comparingLong(Map.Entry::getValue))
                .map(Map.Entry::getKey)
                .orElse(upstreamList.get(0).buildDomain());

        countMap.computeIfPresent(domain, (key, actived) -> Optional.of(actived).orElse(Long.MIN_VALUE) + 1);
        return domainMap.get(domain);
    }
@Test
    public void testResponseTimeBalancer() throws Exception {
        buildUpstreamList();
        final LeastActiveLoadBalance leastActiveLoadBalance = new LeastActiveLoadBalance();
        Upstream upstream = leastActiveLoadBalance.doSelect(onlyOneList, "localhost");
        Upstream upstream1 = leastActiveLoadBalance.doSelect(onlyOneList, "localhost");
        Assertions.assertTrue((upstream.getUrl().equals("baidu.com") && upstream1.getUrl().equals("pro.jd.com"))
                || upstream1.getUrl().equals("baidu.com") && upstream.getUrl().equals("pro.jd.com"));
    }