Skip to content

Commit

Permalink
KAA-1470. Fix Connectivity Checker test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill380 committed Oct 26, 2016
1 parent a478578 commit a6714a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -50,6 +50,7 @@ public boolean checkConnectivity() {


try { try {
try (Socket soc = new Socket()) { try (Socket soc = new Socket()) {
// check if we can reach host (ping) thus we test connectivity
soc.connect(new InetSocketAddress(host, DEFAULT_PORT), CONNECTION_TIMEOUT_MS); soc.connect(new InetSocketAddress(host, DEFAULT_PORT), CONNECTION_TIMEOUT_MS);
} }
return true; return true;
Expand Down
Expand Up @@ -23,13 +23,13 @@ public class PingConnectivityCheckerTest {


@Test @Test
public void checkConnectivityToWrongHostTest() { public void checkConnectivityToWrongHostTest() {
PingConnectivityChecker pingConnectivityChecker = new PingConnectivityChecker("some-wrong-url="); PingConnectivityChecker pingConnectivityChecker = new PingConnectivityChecker("wrong-host");
Assert.assertFalse(pingConnectivityChecker.checkConnectivity()); Assert.assertFalse(pingConnectivityChecker.checkConnectivity());
} }


@Test @Test
public void checkConnectivityForLocalHostTest() { public void checkConnectivityToSomeHostTest() {
PingConnectivityChecker pingConnectivityChecker = new PingConnectivityChecker("http://google.com"); PingConnectivityChecker pingConnectivityChecker = new PingConnectivityChecker("google.com");
Assert.assertTrue(pingConnectivityChecker.checkConnectivity()); Assert.assertTrue(pingConnectivityChecker.checkConnectivity());
} }
} }

0 comments on commit a6714a6

Please sign in to comment.