Why when i connect with a new hostname and the client disconnect and try to reconnect. It takes the previus hostname again and not the current one?

I am working on an Android project, and I have both a cloud hostname and a local one. The issue is that when I connect to the local hostname and then switch to the cloud hostname, the client enters the addDisconnectedListener and reconnects. However, it uses the previous hostname, which results in an error. Why does this happen if I have already connected with another hostname?

Hi Kevin,

Could you please clarify why your client is connecting to another broker when the first one disconnects? Share the link to your project repo. This will help everybody on this forum better understand how your client manages connections.

Looking forward to your response.

Best regards,
Dasha from the HiveMQ Team