modified to work with SSL.  Also differentiated auth error vs connection error