Authenticate() has a try catch statement, within the catch section it tries to re-authenticate which is fine for dropped sessions, however if for example there is a firewall in place or the hostname is incorrect when it retries the connection it catches the error again.