@Test
public void testShuffled() {

    DnsServerAddresses seq = DnsServerAddresses.shuffled(ADDR1, ADDR2, ADDR3);
    // Ensure that all three addresses are returned by the iterator.
    // In theory, this test can fail at extremely low chance, but we don't really care.
    Set<InetSocketAddress> set = Collections.newSetFromMap(new IdentityHashMap<InetSocketAddress, Boolean>());
    DnsServerAddressStream i = seq.stream();
    for (int j = 0; j < 1048576; j ++) {
        set.add(i.next());
    }
    assertThat(set.size(), is(3));
    assertThat(seq.stream(), is(not(sameInstance(seq.stream()))));
}