Adding example code which demonstrates the reconnect handling.