@Test
    public void testManySources() {
        Map<String, Integer> timesUsed = new LinkedHashMap<>();

        ConfigSourceSet twoSources = new ConfigSourceSet(List.of("host0", "host1"));
        JRTConnectionPool sourcePool = new JRTConnectionPool(twoSources);

        int count = 1000;
        for (int i = 0; i < count; i++) {
            String address = sourcePool.switchConnection().getAddress();
            if (timesUsed.containsKey(address)) {
                int times = timesUsed.get(address);
                timesUsed.put(address, times + 1);
            } else {
                timesUsed.put(address, 1);
            }
        }
        assertConnectionDistributionIsFair(timesUsed);
        sourcePool.close();
    }
Tests that when there are two sources and several clients
the sources will be chosen with about the same probability.
config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java