We had an issue with connecting to a 5.18.6 broker that offers only TLSv1.2 and TLSv1.3. The working solution was described in this article.
Change Broker URI to activemq:ssl://servername:port?transport.SslProtocol=Tls12