public static InetSocketAddress[] netAddressToSocketAddress(List<NetAddress> request)
      throws UnknownHostException {
    InetSocketAddress[] addresses = new InetSocketAddress[request.size()];
    for (int i = 0; i < addresses.length; i++) {
      addresses[i] = new InetSocketAddress(
          InetAddress.getByName(request.get(i).getHost()),
          request.get(i).getRpcPort());
    }
    return addresses;
  }
@Test
  public void netAddressTest() throws Exception {
    List<NetAddress> addressList = Collections.singletonList(
        NetAddress.newBuilder().setHost("localhost").setRpcPort(1).build());
    InetSocketAddress[] inetSocketAddressList = netAddressToSocketAddress(addressList);
    Assert.assertEquals(1, inetSocketAddressList.length);
    Assert.assertEquals("localhost", inetSocketAddressList[0].getHostName());
    Assert.assertEquals(1, inetSocketAddressList[0].getPort());
  }