Change the reconnect logic to gracefully handle the server going away and
coming back.