public BrokerRegistrationRequestData.ListenerCollection toBrokerRegistrationRequest() {
        BrokerRegistrationRequestData.ListenerCollection collection =
                new BrokerRegistrationRequestData.ListenerCollection();
        listeners.values().forEach(endpoint -> {
            checkPortIsSerializable(endpoint.port());
            checkHostIsSerializable(endpoint.host());
            collection.add(new BrokerRegistrationRequestData.Listener().
                setHost(endpoint.host()).
                setName(endpoint.listenerName().get()).
                setPort(endpoint.port()).
                setSecurityProtocol(endpoint.securityProtocol().id));
        });
        return collection;
    }
Create a new ListenerInfo object where ephemeral ports are populated with their true runtime
values.

In other words, if a port was set to 0, indicating that a random port should be assigned by the
operating system, this function will replace it with the value the operating system actually
chose.

@param getBoundPortCallback  The callback used to correct ephemeral endpoints.

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