public Endpoint withDefaultPort(int defaultPort) {
        validatePort("defaultPort", defaultPort);

        if (port != 0) {
            return this;
        }

        return new Endpoint(type, host, ipAddr, defaultPort, weight, attributes);
    }
Returns a new host endpoint with the specified default port number.

@param defaultPort the default port number
@return the new endpoint whose port is {@code defaultPort} if this endpoint does not have its port
        specified. {@code this} if this endpoint already has its port specified.
core/src/main/java/com/linecorp/armeria/client/Endpoint.java