Handle reconnecting and connection failed in client