### Question:
MultipleAddresses { public void recreateSocketAddresses() { addresses = addresses.parallelStream() .map(this::recreateSocketAddress) .collect(Collectors.toCollection(MultipleAddresses::newConcurrentHashSet)); } MultipleAddresses();  MultipleAddresses(Collection<InetSocketAddress> addresses);  MultipleAddresses(InetSocketAddress address);  MultipleAddresses(Collection<InetSocketAddress> addresses, Duration timeout); boolean isEmpty(); Set<InetSocketAddress> getAllAddresses(); Set<InetSocketAddress> getWildcardAddresses(); List<Integer> getAllPorts(); List<String> getAllHostStrings(); void addAddress(InetSocketAddress address); InetSocketAddress getReachableAddress(); Set<InetSocketAddress> getAllReachableAddresses(); Set<InetSocketAddress> getAllReachableAddressesOrAll(); InetSocketAddress getReachableOrOne(); void recreateSocketAddresses(); InetSocketAddress getOne(); int size(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final Duration DEFAULT_TIMEOUT; }### Answer:
@Test public void testRecreateSocketAddresses() throws UnknownHostException { List<InetSocketAddress> searchedAddresses = Arrays.stream(InetAddress.getAllByName("google.com")) .map(addr -> new InetSocketAddress(addr, 222)).collect(Collectors.toList()); MultipleAddresses multipleAddresses = new MultipleAddresses(searchedAddresses.get(searchedAddresses.size() - 1)); List<InetSocketAddress> addresses = new ArrayList<>(multipleAddresses.getAllAddresses()); assertEquals(1, addresses.size()); assertEquals(searchedAddresses.get(searchedAddresses.size() - 1), addresses.get(0)); multipleAddresses.recreateSocketAddresses(); addresses = new ArrayList<>(multipleAddresses.getAllAddresses()); assertEquals(1, addresses.size()); assertEquals(searchedAddresses.get(0), addresses.get(0)); }