public Endpoint withIpAddr(@Nullable String ipAddr) {
        if (isDomainSocket()) {
            // A domain socket always has the predefined IP address.
            return this;
        }
        if (ipAddr == null) {
            return withoutIpAddr();
        }

        final String normalizedIpAddr = IpAddrUtil.normalize(ipAddr);
        checkArgument(normalizedIpAddr != null, "ipAddr: %s (expected: a valid IP address)", ipAddr);
        if (normalizedIpAddr.equals(this.ipAddr)) {
            return this;
        }

        if (isIpAddrOnly()) {
            return new Endpoint(Type.IP_ONLY, normalizedIpAddr, normalizedIpAddr, port, weight, attributes);
        } else {
            return new Endpoint(Type.HOSTNAME_AND_IP, host, normalizedIpAddr, port, weight, attributes);
        }
    }
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 IllegalArgumentException if the specified IP address is invalid
core/src/main/java/com/linecorp/armeria/client/Endpoint.java