Added a unit test for the NioConnection which tests for authentication exception handling
Updated the NioConnection based on the results of this unit test