public static ListenerInfo fromBrokerRegistrationRequest(
        BrokerRegistrationRequestData.ListenerCollection collection
    ) {
        LinkedHashMap<String, Endpoint> listeners = new LinkedHashMap<>();
        collection.forEach(listener -> {
            SecurityProtocol protocol = SecurityProtocol.forId(listener.securityProtocol());
            if (protocol == null) {
                throw new RuntimeException("Unknown security protocol " +
                        (int) listener.securityProtocol() + " in listener " + listener.name());
            }
            listeners.put(listener.name(), new Endpoint(listener.name(),
                protocol,
                listener.host(),
                listener.port()));
        });
        return new ListenerInfo(listeners);
    }
Create a ListenerInfo from data in a BrokerRegistrationRequest RPC.

@param collection    The RPC data.

@return              The ListenerInfo object.
metadata/src/main/java/org/apache/kafka/metadata/ListenerInfo.java