DnsServerAddresses { public static DnsServerAddresses singleton(final InetSocketAddress address) { if (address == null) { throw new NullPointerException("address"); } if (address.isUnresolved()) { throw new IllegalArgumentException("cannot use an unresolved DNS server address: " + address); } return new SingletonDnsServerAddresses(address); }  @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 testSingleton() { DnsServerAddresses seq = DnsServerAddresses.singleton(ADDR1); assertThat(seq.stream(), is(sameInstance(seq.stream()))); DnsServerAddressStream i = seq.stream(); assertNext(i, ADDR1); assertNext(i, ADDR1); assertNext(i, ADDR1); }