I am doing integration testing with KafkaContainer; after starting the container, the port is chosen randomly.
KafkaContainer
I can get the port by container.getB
container.getB