/** resolves a single host specification */
 private InetAddress[] resolveInternal(String host) throws IOException {
   if ((host.startsWith("#") && host.endsWith("#"))
       || (host.startsWith("_") && host.endsWith("_"))) {
     host = host.substring(1, host.length() - 1);
     // allow custom resolvers to have special names
     for (CustomNameResolver customNameResolver : customNameResolvers) {
       InetAddress addresses[] = customNameResolver.resolveIfPossible(host);
       if (addresses != null) {
         return addresses;
       }
     }
     switch (host) {
       case "local":
         return NetworkUtils.getLoopbackAddresses();
       case "local:ipv4":
         return NetworkUtils.filterIPV4(NetworkUtils.getLoopbackAddresses());
       case "local:ipv6":
         return NetworkUtils.filterIPV6(NetworkUtils.getLoopbackAddresses());
       case "site":
         return NetworkUtils.getSiteLocalAddresses();
       case "site:ipv4":
         return NetworkUtils.filterIPV4(NetworkUtils.getSiteLocalAddresses());
       case "site:ipv6":
         return NetworkUtils.filterIPV6(NetworkUtils.getSiteLocalAddresses());
       case "global":
         return NetworkUtils.getGlobalAddresses();
       case "global:ipv4":
         return NetworkUtils.filterIPV4(NetworkUtils.getGlobalAddresses());
       case "global:ipv6":
         return NetworkUtils.filterIPV6(NetworkUtils.getGlobalAddresses());
       default:
         /* an interface specification */
         if (host.endsWith(":ipv4")) {
           host = host.substring(0, host.length() - 5);
           return NetworkUtils.filterIPV4(NetworkUtils.getAddressesForInterface(host));
         } else if (host.endsWith(":ipv6")) {
           host = host.substring(0, host.length() - 5);
           return NetworkUtils.filterIPV6(NetworkUtils.getAddressesForInterface(host));
         } else {
           return NetworkUtils.getAddressesForInterface(host);
         }
     }
   }
   return InetAddress.getAllByName(host);
 }