code: private static List<String> resolveDeviceAddress(String deviceName,
             Enumeration<NetworkInterface> networkInterfaces, boolean allowIPv6) {
          List<String> resolvedAddresses = new ArrayList<>();
          if (deviceName.startsWith("[@") && deviceName.endsWith("]")) {
              deviceName = deviceName.substring(2, deviceName.lastIndexOf(']'));
          } else if (deviceName.startsWith("@")) {
              deviceName = deviceName.substring(1);
          }
  
          while (networkInterfaces.hasMoreElements()) {
              NetworkInterface networkInterface = networkInterfaces.nextElement();
              if (deviceName.toLowerCase().equals(networkInterface.getDisplayName().toLowerCase())) {
                  Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
                  while (inetAddresses.hasMoreElements()) {
                      InetAddress inetAddress = inetAddresses.nextElement();
                      if (inetAddress instanceof Inet6Address) {
                          if (!allowIPv6) {
                              continue;
                          }
                          String inet6HostAddress = inetAddress.getHostAddress();
                          resolvedAddresses.add(String.format("[%s]", inet6HostAddress));
                      } else {
                          resolvedAddresses.add(inetAddress.getHostAddress());
                      }
                  }
              }
  
              // add an internal URI for any sub interfaces that match the hostAddress
              Enumeration<NetworkInterface> subInterfaces = networkInterface.getSubInterfaces();
              if (subInterfaces.hasMoreElements()) {
                  resolvedAddresses.addAll(resolveDeviceAddress(deviceName, subInterfaces, allowIPv6));
              }
          }
  
          return resolvedAddresses;
      }
docs: Method performing device address resolution
  @param deviceName
  @param networkInterfaces
  @param allowIPv6
  @return