code: private static void checkAddress(String address, AddressFamily addrFamily) {
          if (addrFamily == null) {
              throw new NullPointerException("addrFamily");
          }
  
          switch (addrFamily) {
              case AF_UNSPEC:
                  if (address != null) {
                      throw new HAProxyProtocolException("unable to validate an AF_UNSPEC address: " + address);
                  }
                  return;
              case AF_UNIX:
                  return;
          }
  
          if (address == null) {
              throw new NullPointerException("address");
          }
  
          switch (addrFamily) {
              case AF_IPv4:
                  if (!NetUtil.isValidIpV4Address(address)) {
                      throw new HAProxyProtocolException("invalid IPv4 address: " + address);
                  }
                  break;
              case AF_IPv6:
                  if (!NetUtil.isValidIpV6Address(address)) {
                      throw new HAProxyProtocolException("invalid IPv6 address: " + address);
                  }
                  break;
              default:
                  throw new Error();
          }
      }
docs: Validate an address (IPv4, IPv6, Unix Socket)
  
  @param address                    human-readable address
  @param addrFamily                 the {@link AddressFamily} to check the address against
  @throws HAProxyProtocolException  if the address is invalid