langohr-36: Use a loop instead of a recursion when recovering connection...

Closes issue #36 - use a loop instead of a recursive call to recoverConnection.