Simple connection tester in Java