fixing authentication chicken/egg problem
initial fix for issue with infinite timeouts.
fixing tests which were asserting the wrong exception type.