Fix checkstyle warnings in netconf-ssh. 63/12863/12
authorMarian Dubai <mdubai@cisco.com>
Fri, 14 Nov 2014 14:55:54 +0000 (15:55 +0100)
committerMarian Dubai <mdubai@cisco.com>
Thu, 27 Nov 2014 09:41:02 +0000 (10:41 +0100)
Change-Id: I01cee96432edcf361b463f89c648823042165b9e
Signed-off-by: Marian Dubai <mdubai@cisco.com>
12 files changed:
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/RemoteNetconfCommand.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/SshProxyClientHandler.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/SshProxyServer.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/AuthProviderTracker.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/EchoClient.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/EchoClientHandler.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/EchoServer.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/EchoServerHandler.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/ProxyServerHandler.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/ssh/authentication/SSHServerTest.java

index e642e073a31bb3fb001d4c446dc66dd87d413087..00a5b4c7c469e3492326fbddf2cbce01c459c243 100644 (file)
@@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory;
  */
 public class RemoteNetconfCommand implements AsyncCommand, SessionAware {
 
  */
 public class RemoteNetconfCommand implements AsyncCommand, SessionAware {
 
-    private static final Logger logger = LoggerFactory.getLogger(RemoteNetconfCommand.class);
+    private static final Logger LOG = LoggerFactory.getLogger(RemoteNetconfCommand.class);
 
     private final EventLoopGroup clientEventGroup;
     private final LocalAddress localAddress;
 
     private final EventLoopGroup clientEventGroup;
     private final LocalAddress localAddress;
@@ -100,7 +100,7 @@ public class RemoteNetconfCommand implements AsyncCommand, SessionAware {
 
     @Override
     public void start(final Environment env) throws IOException {
 
     @Override
     public void start(final Environment env) throws IOException {
-        logger.trace("Establishing internal connection to netconf server for client: {}", getClientAddress());
+        LOG.trace("Establishing internal connection to netconf server for client: {}", getClientAddress());
 
         final Bootstrap clientBootstrap = new Bootstrap();
         clientBootstrap.group(clientEventGroup).channel(LocalChannel.class);
 
         final Bootstrap clientBootstrap = new Bootstrap();
         clientBootstrap.group(clientEventGroup).channel(LocalChannel.class);
@@ -120,7 +120,7 @@ public class RemoteNetconfCommand implements AsyncCommand, SessionAware {
                 if(future.isSuccess()) {
                     clientChannel = clientChannelFuture.channel();
                 } else {
                 if(future.isSuccess()) {
                     clientChannel = clientChannelFuture.channel();
                 } else {
-                    logger.warn("Unable to establish internal connection to netconf server for client: {}", getClientAddress());
+                    LOG.warn("Unable to establish internal connection to netconf server for client: {}", getClientAddress());
                     Preconditions.checkNotNull(callback, "Exit callback must be set");
                     callback.onExit(1, "Unable to establish internal connection to netconf server for client: "+ getClientAddress());
                 }
                     Preconditions.checkNotNull(callback, "Exit callback must be set");
                     callback.onExit(1, "Unable to establish internal connection to netconf server for client: "+ getClientAddress());
                 }
@@ -130,7 +130,7 @@ public class RemoteNetconfCommand implements AsyncCommand, SessionAware {
 
     @Override
     public void destroy() {
 
     @Override
     public void destroy() {
-        logger.trace("Releasing internal connection to netconf server for client: {} on channel: {}",
+        LOG.trace("Releasing internal connection to netconf server for client: {} on channel: {}",
                 getClientAddress(), clientChannel);
 
         clientChannelFuture.cancel(true);
                 getClientAddress(), clientChannel);
 
         clientChannelFuture.cancel(true);
@@ -140,7 +140,7 @@ public class RemoteNetconfCommand implements AsyncCommand, SessionAware {
                 @Override
                 public void operationComplete(final ChannelFuture future) throws Exception {
                     if (future.isSuccess() == false) {
                 @Override
                 public void operationComplete(final ChannelFuture future) throws Exception {
                     if (future.isSuccess() == false) {
-                        logger.warn("Unable to release internal connection to netconf server on channel: {}", clientChannel);
+                        LOG.warn("Unable to release internal connection to netconf server on channel: {}", clientChannel);
                     }
                 }
             });
                     }
                 }
             });
index 2b2b3b3e8187009b6976306293c3c16060a26242..5fa39749110c9fb13eaa8cac139b03f15e970dc8 100644 (file)
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
  */
 final class SshProxyClientHandler extends ChannelInboundHandlerAdapter {
 
  */
 final class SshProxyClientHandler extends ChannelInboundHandlerAdapter {
 
-    private static final Logger logger = LoggerFactory.getLogger(SshProxyClientHandler.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SshProxyClientHandler.class);
 
     private final IoInputStream in;
     private final IoOutputStream out;
 
     private final IoInputStream in;
     private final IoOutputStream out;
@@ -64,8 +64,8 @@ final class SshProxyClientHandler extends ChannelInboundHandlerAdapter {
         }, new AsyncSshHandlerReader.ReadMsgHandler() {
             @Override
             public void onMessageRead(final ByteBuf msg) {
         }, new AsyncSshHandlerReader.ReadMsgHandler() {
             @Override
             public void onMessageRead(final ByteBuf msg) {
-                if(logger.isTraceEnabled()) {
-                    logger.trace("Forwarding message for client: {} on channel: {}, message: {}",
+                if(LOG.isTraceEnabled()) {
+                    LOG.trace("Forwarding message for client: {} on channel: {}, message: {}",
                             netconfHelloMessageAdditionalHeader.getAddress(), ctx.channel(), AsyncSshHandlerWriter.byteBufToString(msg));
                 }
                 // Just forward to delegate
                             netconfHelloMessageAdditionalHeader.getAddress(), ctx.channel(), AsyncSshHandlerWriter.byteBufToString(msg));
                 }
                 // Just forward to delegate
@@ -83,12 +83,12 @@ final class SshProxyClientHandler extends ChannelInboundHandlerAdapter {
 
     @Override
     public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
 
     @Override
     public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
-       asyncSshHandlerWriter.write(ctx, msg, ctx.newPromise());
+        asyncSshHandlerWriter.write(ctx, msg, ctx.newPromise());
     }
 
     @Override
     public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
     }
 
     @Override
     public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
-        logger.debug("Internal connection to netconf server was dropped for client: {} on channel: ",
+        LOG.debug("Internal connection to netconf server was dropped for client: {} on channel: ",
                 netconfHelloMessageAdditionalHeader.getAddress(), ctx.channel());
         callback.onExit(1, "Internal connection to netconf server was dropped for client: " +
                 netconfHelloMessageAdditionalHeader.getAddress() + " on channel: " + ctx.channel());
                 netconfHelloMessageAdditionalHeader.getAddress(), ctx.channel());
         callback.onExit(1, "Internal connection to netconf server was dropped for client: " +
                 netconfHelloMessageAdditionalHeader.getAddress() + " on channel: " + ctx.channel());
index 20088fe87603f353fcd560f81e1e1b55e0d2855b..e41a3eaa2cc9f5ea9555bd6d71b9103534bdca5a 100644 (file)
@@ -70,11 +70,13 @@ public class SshProxyServer implements AutoCloseable {
 
     private static Map<String, String> getProperties(final SshProxyServerConfiguration sshProxyServerConfiguration) {
         return new HashMap<String, String>()
 
     private static Map<String, String> getProperties(final SshProxyServerConfiguration sshProxyServerConfiguration) {
         return new HashMap<String, String>()
-        {{
-            put(ServerFactoryManager.IDLE_TIMEOUT, String.valueOf(sshProxyServerConfiguration.getIdleTimeout()));
-            // TODO make auth timeout configurable on its own
-            put(ServerFactoryManager.AUTH_TIMEOUT, String.valueOf(sshProxyServerConfiguration.getIdleTimeout()));
-        }};
+        {
+            {
+                put(ServerFactoryManager.IDLE_TIMEOUT, String.valueOf(sshProxyServerConfiguration.getIdleTimeout()));
+                // TODO make auth timeout configurable on its own
+                put(ServerFactoryManager.AUTH_TIMEOUT, String.valueOf(sshProxyServerConfiguration.getIdleTimeout()));
+            }
+        };
     }
 
     @Override
     }
 
     @Override
index 97e611c0d23a7eea5ecd5cdceb2a54bea54e15cf..c473b70eee7a981dadd71f671ec462abcab215cd 100644 (file)
@@ -21,7 +21,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 final class AuthProviderTracker implements ServiceTrackerCustomizer<AuthProvider, AuthProvider>, PasswordAuthenticator {
 import org.slf4j.LoggerFactory;
 
 final class AuthProviderTracker implements ServiceTrackerCustomizer<AuthProvider, AuthProvider>, PasswordAuthenticator {
-    private static final Logger logger = LoggerFactory.getLogger(AuthProviderTracker.class);
+    private static final Logger LOG = LoggerFactory.getLogger(AuthProviderTracker.class);
 
     private final BundleContext bundleContext;
 
 
     private final BundleContext bundleContext;
 
@@ -37,7 +37,7 @@ final class AuthProviderTracker implements ServiceTrackerCustomizer<AuthProvider
 
     @Override
     public AuthProvider addingService(final ServiceReference<AuthProvider> reference) {
 
     @Override
     public AuthProvider addingService(final ServiceReference<AuthProvider> reference) {
-        logger.trace("Service {} added", reference);
+        LOG.trace("Service {} added", reference);
         final AuthProvider authService = bundleContext.getService(reference);
         final Integer newServicePreference = getPreference(reference);
         if(isBetter(newServicePreference)) {
         final AuthProvider authService = bundleContext.getService(reference);
         final Integer newServicePreference = getPreference(reference);
         if(isBetter(newServicePreference)) {
@@ -66,15 +66,15 @@ final class AuthProviderTracker implements ServiceTrackerCustomizer<AuthProvider
         final AuthProvider authService = bundleContext.getService(reference);
         final Integer newServicePreference = getPreference(reference);
         if(isBetter(newServicePreference)) {
         final AuthProvider authService = bundleContext.getService(reference);
         final Integer newServicePreference = getPreference(reference);
         if(isBetter(newServicePreference)) {
-            logger.trace("Replacing modified service {} in netconf SSH.", reference);
+            LOG.trace("Replacing modified service {} in netconf SSH.", reference);
             this.authProvider = authService;
         }
     }
 
     @Override
     public void removedService(final ServiceReference<AuthProvider> reference, final AuthProvider service) {
             this.authProvider = authService;
         }
     }
 
     @Override
     public void removedService(final ServiceReference<AuthProvider> reference, final AuthProvider service) {
-        logger.trace("Removing service {} from netconf SSH. " +
-                "SSH won't authenticate users until AuthProvider service will be started.", reference);
+        LOG.trace("Removing service {} from netconf SSH. {}", reference,
+                " SSH won't authenticate users until AuthProvider service will be started.");
         maxPreference = null;
         this.authProvider = null;
     }
         maxPreference = null;
         this.authProvider = null;
     }
index 5fc04eee8305279d9c3ab3dec67933c6bfe6435b..b098329e4a01b13c33e737cf7315ad4746f13f92 100644 (file)
@@ -33,7 +33,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class NetconfSSHActivator implements BundleActivator {
 import org.slf4j.LoggerFactory;
 
 public class NetconfSSHActivator implements BundleActivator {
-    private static final Logger logger = LoggerFactory.getLogger(NetconfSSHActivator.class);
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfSSHActivator.class);
 
     private static final java.lang.String ALGORITHM = "RSA";
     private static final int KEY_SIZE = 4096;
 
     private static final java.lang.String ALGORITHM = "RSA";
     private static final int KEY_SIZE = 4096;
@@ -87,12 +87,12 @@ public class NetconfSSHActivator implements BundleActivator {
         final Optional<InetSocketAddress> maybeSshSocketAddress = NetconfConfigUtil.extractNetconfServerAddress(bundleContext, InfixProp.ssh);
 
         if (maybeSshSocketAddress.isPresent() == false) {
         final Optional<InetSocketAddress> maybeSshSocketAddress = NetconfConfigUtil.extractNetconfServerAddress(bundleContext, InfixProp.ssh);
 
         if (maybeSshSocketAddress.isPresent() == false) {
-            logger.trace("SSH bridge not configured");
+            LOG.trace("SSH bridge not configured");
             return null;
         }
 
         final InetSocketAddress sshSocketAddress = maybeSshSocketAddress.get();
             return null;
         }
 
         final InetSocketAddress sshSocketAddress = maybeSshSocketAddress.get();
-        logger.trace("Starting netconf SSH bridge at {}", sshSocketAddress);
+        LOG.trace("Starting netconf SSH bridge at {}", sshSocketAddress);
 
         final LocalAddress localAddress = NetconfConfigUtil.getNetconfLocalAddress();
 
 
         final LocalAddress localAddress = NetconfConfigUtil.getNetconfLocalAddress();
 
index b768e2b1d1ce08d8cef9585c538837157405bdc6..bdaee7957d277ef7bff5c9aafb81e1e0fcd85cb5 100644 (file)
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
  * the server.
  */
 public class EchoClient extends Thread {
  * the server.
  */
 public class EchoClient extends Thread {
-    private static final Logger logger = LoggerFactory.getLogger(EchoClient.class);
+    private static final Logger LOG = LoggerFactory.getLogger(EchoClient.class);
 
 
     private final ChannelInitializer<LocalChannel> channelInitializer;
 
 
     private final ChannelInitializer<LocalChannel> channelInitializer;
@@ -63,11 +63,11 @@ public class EchoClient extends Thread {
             // Wait until the connection is closed.
             f.channel().closeFuture().sync();
         } catch (Exception e) {
             // Wait until the connection is closed.
             f.channel().closeFuture().sync();
         } catch (Exception e) {
-            logger.error("Error in client", e);
+            LOG.error("Error in client", e);
             throw new RuntimeException("Error in client", e);
         } finally {
             // Shut down the event loop to terminate all threads.
             throw new RuntimeException("Error in client", e);
         } finally {
             // Shut down the event loop to terminate all threads.
-            logger.info("Client is shutting down");
+            LOG.info("Client is shutting down");
             group.shutdownGracefully();
         }
     }
             group.shutdownGracefully();
         }
     }
index 2a5791710a34cd7869ca4250cab4717c33b32f05..1d3cd5325cb99f77c40a270f8963abd2ed2e3a12 100644 (file)
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
  * the server.
  */
 public class EchoClientHandler extends ChannelInboundHandlerAdapter implements ChannelFutureListener {
  * the server.
  */
 public class EchoClientHandler extends ChannelInboundHandlerAdapter implements ChannelFutureListener {
-    private static final Logger logger = LoggerFactory.getLogger(EchoClientHandler.class);
+    private static final Logger LOG = LoggerFactory.getLogger(EchoClientHandler.class);
 
     private ChannelHandlerContext ctx;
     private final StringBuilder fromServer = new StringBuilder();
 
     private ChannelHandlerContext ctx;
     private final StringBuilder fromServer = new StringBuilder();
@@ -39,7 +39,7 @@ public class EchoClientHandler extends ChannelInboundHandlerAdapter implements C
     @Override
     public synchronized void channelActive(ChannelHandlerContext ctx) {
         checkState(this.ctx == null);
     @Override
     public synchronized void channelActive(ChannelHandlerContext ctx) {
         checkState(this.ctx == null);
-        logger.info("channelActive");
+        LOG.info("channelActive");
         this.ctx = ctx;
         state = State.CONNECTED;
     }
         this.ctx = ctx;
         state = State.CONNECTED;
     }
@@ -54,14 +54,14 @@ public class EchoClientHandler extends ChannelInboundHandlerAdapter implements C
         ByteBuf bb = (ByteBuf) msg;
         String string = bb.toString(Charsets.UTF_8);
         fromServer.append(string);
         ByteBuf bb = (ByteBuf) msg;
         String string = bb.toString(Charsets.UTF_8);
         fromServer.append(string);
-        logger.info(">{}", string);
+        LOG.info(">{}", string);
         bb.release();
     }
 
     @Override
     public synchronized void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
         // Close the connection when an exception is raised.
         bb.release();
     }
 
     @Override
     public synchronized void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
         // Close the connection when an exception is raised.
-        logger.warn("Unexpected exception from downstream.", cause);
+        LOG.warn("Unexpected exception from downstream.", cause);
         checkState(this.ctx.equals(ctx));
         ctx.close();
         this.ctx = null;
         checkState(this.ctx.equals(ctx));
         ctx.close();
         this.ctx = null;
@@ -84,7 +84,7 @@ public class EchoClientHandler extends ChannelInboundHandlerAdapter implements C
     public synchronized void operationComplete(ChannelFuture future) throws Exception {
         checkState(state == State.CONNECTING);
         if (future.isSuccess()) {
     public synchronized void operationComplete(ChannelFuture future) throws Exception {
         checkState(state == State.CONNECTING);
         if (future.isSuccess()) {
-            logger.trace("Successfully connected, state will be switched in channelActive");
+            LOG.trace("Successfully connected, state will be switched in channelActive");
         } else {
             state = State.FAILED_TO_CONNECT;
         }
         } else {
             state = State.FAILED_TO_CONNECT;
         }
index ec89d75f297720c88aa7e1c76fb90857c79b62d3..5d184411f9bd01d6a0e475c6001440c136c4ff94 100644 (file)
@@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
  * Echoes back any received data from a client.
  */
 public class EchoServer implements Runnable {
  * Echoes back any received data from a client.
  */
 public class EchoServer implements Runnable {
-    private static final Logger logger = LoggerFactory.getLogger(EchoServer.class);
+    private static final Logger LOG = LoggerFactory.getLogger(EchoServer.class);
 
     public void run() {
         // Configure the server.
 
     public void run() {
         // Configure the server.
@@ -76,7 +76,7 @@ public class EchoServer implements Runnable {
             if (message == null ||  "exit".equalsIgnoreCase(message)) {
                 break;
             }
             if (message == null ||  "exit".equalsIgnoreCase(message)) {
                 break;
             }
-            logger.debug("Got '{}'", message);
+            LOG.debug("Got '{}'", message);
             clientHandler.write(message);
         } while (true);
         System.exit(0);
             clientHandler.write(message);
         } while (true);
         System.exit(0);
index 1286ec6875b3b61bf393775082a447ae2cc55463..abb6658b11a7dcfff730ded38b096aa22349bd6a 100644 (file)
@@ -23,26 +23,26 @@ import org.slf4j.LoggerFactory;
 @Sharable
 public class EchoServerHandler extends ChannelInboundHandlerAdapter {
 
 @Sharable
 public class EchoServerHandler extends ChannelInboundHandlerAdapter {
 
-    private static final Logger logger = LoggerFactory.getLogger(EchoServerHandler.class.getName());
+    private static final Logger LOG = LoggerFactory.getLogger(EchoServerHandler.class);
     private String fromLastNewLine = "";
     private final Splitter splitter = Splitter.onPattern("\r?\n");
     @Override
     public void channelActive(ChannelHandlerContext ctx) throws Exception {
     private String fromLastNewLine = "";
     private final Splitter splitter = Splitter.onPattern("\r?\n");
     @Override
     public void channelActive(ChannelHandlerContext ctx) throws Exception {
-        logger.debug("sleep start");
+        LOG.debug("sleep start");
         Thread.sleep(1000);
         Thread.sleep(1000);
-        logger.debug("sleep done");
+        LOG.debug("sleep done");
     }
 
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
         ByteBuf byteBuf = (ByteBuf) msg;
         String message = byteBuf.toString(Charsets.UTF_8);
     }
 
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
         ByteBuf byteBuf = (ByteBuf) msg;
         String message = byteBuf.toString(Charsets.UTF_8);
-        logger.info("writing back '{}'", message);
+        LOG.info("writing back '{}'", message);
         ctx.write(msg);
         fromLastNewLine += message;
         for (String line : splitter.split(fromLastNewLine)) {
             if ("quit".equals(line)) {
         ctx.write(msg);
         fromLastNewLine += message;
         for (String line : splitter.split(fromLastNewLine)) {
             if ("quit".equals(line)) {
-                logger.info("closing server ctx");
+                LOG.info("closing server ctx");
                 ctx.flush();
                 ctx.close();
                 break;
                 ctx.flush();
                 ctx.close();
                 break;
@@ -55,7 +55,7 @@ public class EchoServerHandler extends ChannelInboundHandlerAdapter {
 
     @Override
     public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
 
     @Override
     public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
-        logger.debug("flushing");
+        LOG.debug("flushing");
         ctx.flush();
     }
 }
         ctx.flush();
     }
 }
index ecab21256ec9bfc9f8c6122360fd22b62cd88d5b..e633ab2332dde4a7426b7ebb8cef9b1efdc73000 100644 (file)
@@ -24,7 +24,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ProxyServerHandler extends ChannelInboundHandlerAdapter {
 import org.slf4j.LoggerFactory;
 
 public class ProxyServerHandler extends ChannelInboundHandlerAdapter {
-    private static final Logger logger = LoggerFactory.getLogger(ProxyServerHandler.class.getName());
+    private static final Logger LOG = LoggerFactory.getLogger(ProxyServerHandler.class);
     private final Bootstrap clientBootstrap;
     private final LocalAddress localAddress;
 
     private final Bootstrap clientBootstrap;
     private final LocalAddress localAddress;
 
@@ -53,32 +53,32 @@ public class ProxyServerHandler extends ChannelInboundHandlerAdapter {
 
     @Override
     public void channelInactive(ChannelHandlerContext ctx) {
 
     @Override
     public void channelInactive(ChannelHandlerContext ctx) {
-        logger.info("channelInactive - closing client connection");
+        LOG.info("channelInactive - closing client connection");
         clientChannel.close();
     }
 
     @Override
     public void channelRead(ChannelHandlerContext ctx, final Object msg) {
         clientChannel.close();
     }
 
     @Override
     public void channelRead(ChannelHandlerContext ctx, final Object msg) {
-        logger.debug("Writing to client {}", msg);
+        LOG.debug("Writing to client {}", msg);
         clientChannel.write(msg);
     }
 
     @Override
     public void channelReadComplete(ChannelHandlerContext ctx) {
         clientChannel.write(msg);
     }
 
     @Override
     public void channelReadComplete(ChannelHandlerContext ctx) {
-        logger.debug("flushing");
+        LOG.debug("flushing");
         clientChannel.flush();
     }
 
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
         // Close the connection when an exception is raised.
         clientChannel.flush();
     }
 
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
         // Close the connection when an exception is raised.
-        logger.warn("Unexpected exception from downstream.", cause);
+        LOG.warn("Unexpected exception from downstream.", cause);
         ctx.close();
     }
 }
 
 class ProxyClientHandler extends ChannelInboundHandlerAdapter {
         ctx.close();
     }
 }
 
 class ProxyClientHandler extends ChannelInboundHandlerAdapter {
-    private static final Logger logger = LoggerFactory.getLogger(ProxyClientHandler.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ProxyClientHandler.class);
 
     private final ChannelHandlerContext remoteCtx;
 
 
     private final ChannelHandlerContext remoteCtx;
 
@@ -89,33 +89,33 @@ class ProxyClientHandler extends ChannelInboundHandlerAdapter {
 
     @Override
     public void channelActive(ChannelHandlerContext ctx) {
 
     @Override
     public void channelActive(ChannelHandlerContext ctx) {
-        logger.info("client active");
+        LOG.info("client active");
     }
 
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) {
         ByteBuf bb = (ByteBuf) msg;
     }
 
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) {
         ByteBuf bb = (ByteBuf) msg;
-        logger.info(">{}", bb.toString(Charsets.UTF_8));
+        LOG.info(">{}", bb.toString(Charsets.UTF_8));
         remoteCtx.write(msg);
     }
 
     @Override
     public void channelReadComplete(ChannelHandlerContext ctx) {
         remoteCtx.write(msg);
     }
 
     @Override
     public void channelReadComplete(ChannelHandlerContext ctx) {
-        logger.debug("Flushing server ctx");
+        LOG.debug("Flushing server ctx");
         remoteCtx.flush();
     }
 
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
         // Close the connection when an exception is raised.
         remoteCtx.flush();
     }
 
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
         // Close the connection when an exception is raised.
-        logger.warn("Unexpected exception from downstream", cause);
+        LOG.warn("Unexpected exception from downstream", cause);
         ctx.close();
     }
 
     // called both when local or remote connection dies
     @Override
     public void channelInactive(ChannelHandlerContext ctx) {
         ctx.close();
     }
 
     // called both when local or remote connection dies
     @Override
     public void channelInactive(ChannelHandlerContext ctx) {
-        logger.debug("channelInactive() called, closing remote client ctx");
+        LOG.debug("channelInactive() called, closing remote client ctx");
         remoteCtx.close();
     }
 }
         remoteCtx.close();
     }
 }
index b682099595a3ce077a77b9c152a6de7d5a698c04..2802488170ef9cc9ef6d27b3846592b19219ca9b 100644 (file)
@@ -42,7 +42,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class SSHTest {
 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;
     public static final String AHOJ = "ahoj\n";
 
     private static EventLoopGroup nettyGroup;
@@ -89,7 +89,7 @@ public class SSHTest {
             Thread.sleep(500);
         }
         assertTrue(echoClientHandler.isConnected());
             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
         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 {
             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();
         }
     }
             sshProxyServer.close();
         }
     }
index 297cf896da498bec242afa26d6b0c2037946d146..7a76285dd2a125ac7cbabbf72b69ff90166ac5b9 100644 (file)
@@ -14,8 +14,8 @@ import static org.mockito.Mockito.doReturn;
 
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
 
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
-import java.net.InetSocketAddress;
 import java.io.File;
 import java.io.File;
+import java.net.InetSocketAddress;
 import java.nio.file.Files;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.nio.file.Files;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -48,7 +48,7 @@ public class SSHServerTest {
     private static final String PASSWORD = "netconf";
     private static final String HOST = "127.0.0.1";
     private static final int PORT = 1830;
     private static final String PASSWORD = "netconf";
     private static final String HOST = "127.0.0.1";
     private static final int PORT = 1830;
-    private static final Logger logger = LoggerFactory.getLogger(SSHServerTest.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SSHServerTest.class);
 
     private File sshKeyPair;
     private SshProxyServer server;
 
     private File sshKeyPair;
     private SshProxyServer server;
@@ -69,7 +69,7 @@ public class SSHServerTest {
         doNothing().when(mockedContext).addServiceListener(any(ServiceListener.class), anyString());
         doReturn(new ServiceReference[0]).when(mockedContext).getServiceReferences(anyString(), anyString());
 
         doNothing().when(mockedContext).addServiceListener(any(ServiceListener.class), anyString());
         doReturn(new ServiceReference[0]).when(mockedContext).getServiceReferences(anyString(), anyString());
 
-        logger.info("Creating SSH server");
+        LOG.info("Creating SSH server");
 
         final InetSocketAddress addr = InetSocketAddress.createUnresolved(HOST, PORT);
         server = new SshProxyServer(minaTimerEx, clientGroup, nioExec);
 
         final InetSocketAddress addr = InetSocketAddress.createUnresolved(HOST, PORT);
         server = new SshProxyServer(minaTimerEx, clientGroup, nioExec);
@@ -80,7 +80,7 @@ public class SSHServerTest {
                         return true;
                     }
                 }).setKeyPairProvider(new PEMGeneratorHostKeyProvider(sshKeyPair.toPath().toAbsolutePath().toString())).setIdleTimeout(Integer.MAX_VALUE).createSshProxyServerConfiguration());
                         return true;
                     }
                 }).setKeyPairProvider(new PEMGeneratorHostKeyProvider(sshKeyPair.toPath().toAbsolutePath().toString())).setIdleTimeout(Integer.MAX_VALUE).createSshProxyServerConfiguration());
-        logger.info("SSH server started on " + PORT);
+        LOG.info("SSH server started on {}", PORT);
     }
 
     @Test
     }
 
     @Test