DnsServerAddresses { public static DnsServerAddresses shuffled(Iterable<? extends InetSocketAddress> addresses) { return shuffled0(sanitize(addresses)); }  @Deprecated static List<InetSocketAddress> defaultAddressList(); @Deprecated static DnsServerAddresses defaultAddresses(); static DnsServerAddresses sequential(Iterable<? extends InetSocketAddress> addresses); static DnsServerAddresses sequential(InetSocketAddress... addresses); static DnsServerAddresses shuffled(Iterable<? extends InetSocketAddress> addresses); static DnsServerAddresses shuffled(InetSocketAddress... addresses); static DnsServerAddresses rotational(Iterable<? extends InetSocketAddress> addresses); static DnsServerAddresses rotational(InetSocketAddress... addresses); static DnsServerAddresses singleton(final InetSocketAddress address); abstract DnsServerAddressStream stream();  }
@Test public void testShuffled() { DnsServerAddresses seq = DnsServerAddresses.shuffled(ADDR1, ADDR2, ADDR3); 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())))); }