It looks like you are attempting to connect with null as the Authenticator. It should be throwing an AuthenticationFailedException which would be picked up by the catch exception block at the end....