DefaultAddressService implements AddressService { public void setAddressList(List<String> addresses) { if (addresses == null || addresses.isEmpty()) { return; } List<Address> addressList = new ArrayList<Address>(); for (String addressStr : addresses) { addressList.add(new Address(addressStr.trim())); } this.addressList = addressList; } DefaultAddressService();  DefaultAddressService(String appName); void clearAddressCache(); void setAgentTestUrl(String agentTestUrl); void setAgentServerVip(String agentServerVip); void setAddressList(List<String> addresses); @Override boolean isAgentServerExisted(); @Override Address getAgentServerHost();  }
@Test public void testSetAddressList() { AddressService addressService = new DefaultAddressService(); Assert.assertFalse(addressService.isAgentServerExisted()); ((DefaultAddressService) addressService).setAddressList(Lists.newArrayList("127.0.0.1", "127.0.0.2")); Assert.assertTrue(addressService.isAgentServerExisted()); Address address = addressService.getAgentServerHost(); System.out.println(address); Assert.assertTrue(address.ip().startsWith("127.0.0")); }