code: public Endpoint withIpAddr(@Nullable String ipAddr) {
          ensureSingle();
          if (ipAddr == null) {
              return withoutIpAddr();
          }
  
          if (NetUtil.isValidIpV4Address(ipAddr)) {
              return withIpAddr(ipAddr, StandardProtocolFamily.INET);
          }
  
          if (NetUtil.isValidIpV6Address(ipAddr)) {
              if (ipAddr.charAt(0) == '[') {
                  ipAddr = ipAddr.substring(1, ipAddr.length() - 1);
              }
              return withIpAddr(ipAddr, StandardProtocolFamily.INET6);
          }
  
          throw new IllegalArgumentException("ipAddr: " + ipAddr + " (expected: an IP address)");
      }
docs: Returns a new host endpoint with the specified IP address.
  
  @return the new endpoint with the specified IP address.
  {@code this} if this endpoint has the same IP address.
  
  @throws IllegalStateException if this endpoint is not a host but a group