Updated the class to test the connection on construct