X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-ssh%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fnetty%2FSSHTest.java;h=d7d8660ae49149923cf60ada5b236dff745f9aed;hb=95115ca49f3b16b936e0f6c88aedfc17cd0ee92c;hp=b682099595a3ce077a77b9c152a6de7d5a698c04;hpb=e2975aec3b5810cb198a31c6422477186818e7fe;p=controller.git diff --git a/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java b/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java index b682099595..d7d8660ae4 100644 --- a/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java +++ b/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java @@ -42,7 +42,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SSHTest { - public static final Logger logger = LoggerFactory.getLogger(SSHTest.class); + private static final Logger LOG = LoggerFactory.getLogger(SSHTest.class); public static final String AHOJ = "ahoj\n"; private static EventLoopGroup nettyGroup; @@ -61,7 +61,7 @@ public class SSHTest { @AfterClass public static void tearDown() throws Exception { hashedWheelTimer.stop(); - nettyGroup.shutdownGracefully().await(); + nettyGroup.shutdownGracefully().await(5, TimeUnit.SECONDS); minaTimerEx.shutdownNow(); nioExec.shutdownNow(); } @@ -84,12 +84,12 @@ public class SSHTest { final EchoClientHandler echoClientHandler = connectClient(addr); - Stopwatch stopwatch = new Stopwatch().start(); + Stopwatch stopwatch = Stopwatch.createStarted(); while(echoClientHandler.isConnected() == false && stopwatch.elapsed(TimeUnit.SECONDS) < 30) { Thread.sleep(500); } assertTrue(echoClientHandler.isConnected()); - logger.info("connected, writing to client"); + LOG.info("connected, writing to client"); echoClientHandler.write(AHOJ); // check that server sent back the same string @@ -102,7 +102,7 @@ public class SSHTest { final String read = echoClientHandler.read(); assertTrue(read + " should end with " + AHOJ, read.endsWith(AHOJ)); } finally { - logger.info("Closing socket"); + LOG.info("Closing socket"); sshProxyServer.close(); } } @@ -131,12 +131,12 @@ public class SSHTest { public void testClientWithoutServer() throws Exception { final InetSocketAddress address = new InetSocketAddress(12345); final EchoClientHandler echoClientHandler = connectClient(address); - final Stopwatch stopwatch = new Stopwatch().start(); + final Stopwatch stopwatch = Stopwatch.createStarted(); while(echoClientHandler.getState() == State.CONNECTING && stopwatch.elapsed(TimeUnit.SECONDS) < 5) { Thread.sleep(100); } assertFalse(echoClientHandler.isConnected()); - assertEquals(State.CONNECTION_CLOSED, echoClientHandler.getState()); + assertEquals(State.FAILED_TO_CONNECT, echoClientHandler.getState()); } }