Retry connecting if it fails using exponential backoff.