public static String transformToIPv6(String ipv4, int port) {
    if (NetUtil.isValidIpV4Address(ipv4)) {
      try {
        return concatHostPort(InetAddress.getByName("::ffff:" + ipv4).getHostAddress(), port);
      } catch (UnknownHostException e) {
        throw new RuntimeException(e);
      }
    } else {
      return ipv4;
    }
  }
Concatenates the host transformed to IPv6 and port with a colon.
Used in some tests which use hardcoded IPv4 addresses and ports that need to be IPv6 when active stack is IPv6.
@param ipv4 An IPv4 address
@param port port
@return the concatenated and transformed to IPv6 host and port
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/common/IPStackUtils.java