public Endpoint withWeight(int weight) {
        validateWeight(weight);
        if (this.weight == weight) {
            return this;
        }
        return new Endpoint(type, host, ipAddr, port, weight, attributes);
    }
Returns a new host endpoint with the specified weight.

@return the new endpoint with the specified weight. {@code this} if this endpoint has the same weight.
core/src/main/java/com/linecorp/armeria/client/Endpoint.java