Add retry mechanism for client.connect()