default URI validateUri(URI uri) {
        requireNonNull(uri, "uri");

        if (ClientBuilderParamsUtil.isInternalUri(uri)) {
            // We use a special marker URI for clients that do not explicitly define a
            // host or scheme at construction time.
            // As this isn't created by users, we don't need to normalize it.
            return uri;
        }

        if (uri.getAuthority() == null) {
            throw new IllegalArgumentException("URI with missing authority: " + uri);
        }

        final String scheme = uri.getScheme();
        if (scheme == null) {
            throw new IllegalArgumentException("URI with missing scheme: " + uri);
        }
        final Scheme parsedScheme = Scheme.tryParse(scheme);
        if (parsedScheme == null) {
            throw new IllegalArgumentException("URI with undefined scheme: " + uri);
        }

        final Set<Scheme> supportedSchemes = supportedSchemes();
        if (!supportedSchemes.contains(parsedScheme)) {
            throw new IllegalArgumentException(
                    "URI with unsupported scheme: " + uri + " (expected: " + supportedSchemes + ')');
        }

        final String parsedSchemeStr;
        if (parsedScheme.serializationFormat() == SerializationFormat.NONE) {
            parsedSchemeStr = parsedScheme.sessionProtocol().uriText();
        } else {
            parsedSchemeStr = parsedScheme.uriText();
        }

        final String path = Strings.emptyToNull(uri.getRawPath());
        if (scheme.equals(parsedSchemeStr) && path != null) {
            return uri;
        }

        // Replace the specified URI's scheme with the normalized one.
        try {
            return new URI(parsedSchemeStr, uri.getRawAuthority(),
                           firstNonNull(path, "/"), uri.getRawQuery(),
                           uri.getRawFragment());
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException(e.getMessage(), e);
        }
    }
Makes sure the specified {@link URI} is supported by this {@link ClientFactory}.

@param uri the {@link URI} of the server endpoint
@return the validated and normalized {@link URI} which always has a non-empty path.

@throws IllegalArgumentException if the scheme of the specified {@link URI} is not supported by this
                                 {@link ClientFactory}
core/src/main/java/com/linecorp/armeria/client/ClientFactory.java