public boolean matchAnyOfPreferredProtocols(ClickHouseProtocol protocol) {
        boolean matched = protocols.isEmpty() || protocol == ClickHouseProtocol.ANY;

        if (!matched && protocol != null) {
            for (ClickHouseProtocol p : protocols) {
                if (p == protocol) {
                    matched = true;
                    break;
                }
            }
        }

        return matched;
    }
Checks if the given protocol matches any of the preferred protocols.

@param protocol protocol to check
@return true if the protocol matches at least one of preferred protocols;
        false otherwise
clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNodeSelector.java