Cannot reconnect to Broker

Dear all,

I want my application to automatically reconnect to the Broker when the connection is lost by some external cause (for example if someone has pulled the plug). But for some reason unknown to me, I cannot get it to work.

Attached you will find two simple Java files which demonstrate my problems.

Please help me out here.

Thanks in advance!


TestClient1 (2.3 k)

TestClient2 (2.5 k)