fixed handler & detect the the lost broker info and the unsent data.

1. fixed to call handler twice when the handlers are implemented.
2. send the unsent data to application when the broker has problem.
3. send the broker info to application when the broker has problem.