Extract server retry into separate class.