Handle connection timeouts in the API