Added code to test the connection and report a different error message
when connecting