You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2016/09/15 19:34:38 UTC

[01/16] mina-sshd git commit: [SSHD-698] Code cleanup

Repository: mina-sshd
Updated Branches:
  refs/heads/master 13989b4f2 -> 977b7b529


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
index 13ce2a9..4cc8fc5 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
@@ -53,7 +53,7 @@ public class ChannelSessionTest extends BaseTestSupport {
         try (ChannelSession channelSession = new ChannelSession() {
                 {
                     Window wRemote = getRemoteWindow();
-                    wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.<String, Object>emptyMap()));
+                    wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
                 }
         }) {
             final AtomicBoolean expanded = new AtomicBoolean(false);
@@ -75,7 +75,7 @@ public class ChannelSessionTest extends BaseTestSupport {
         try (ChannelSession session = new ChannelSession() {
             {
                 Window wRemote = getRemoteWindow();
-                wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.<String, Object>emptyMap()));
+                wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
             }
         }) {
             session.addCloseFutureListener(new SshFutureListener<CloseFuture>() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java b/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java
index e15aa44..5b41665 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java
@@ -77,9 +77,9 @@ public class TtyFilterOutputStreamTest extends BaseTestSupport {
                     }
                 }
             };
-            TtyFilterOutputStream ttyOut = new TtyFilterOutputStream(
-                    output, null, PtyMode.ECHO.equals(mode) ? Collections.<PtyMode>emptySet() : EnumSet.of(mode));
-            Writer writer = new OutputStreamWriter(ttyOut, StandardCharsets.UTF_8)) {
+             TtyFilterOutputStream ttyOut = new TtyFilterOutputStream(
+                    output, null, PtyMode.ECHO.equals(mode) ? Collections.emptySet() : EnumSet.of(mode));
+             Writer writer = new OutputStreamWriter(ttyOut, StandardCharsets.UTF_8)) {
 
             for (String l : lines) {
                 writer.append(l).append("\r\n");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java b/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java
index 4cc9472..7c328a1 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java
@@ -32,7 +32,6 @@ import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.config.SshConfigFileReader;
 import org.apache.sshd.common.io.IoServiceFactory;
 import org.apache.sshd.common.io.mina.MinaServiceFactory;
@@ -319,7 +318,7 @@ public final class SshFsMounter {
         sshd.setPasswordAuthenticator(AcceptAllPasswordAuthenticator.INSTANCE);
         sshd.setTcpipForwardingFilter(AcceptAllForwardingFilter.INSTANCE);
         sshd.setCommandFactory(new ScpCommandFactory.Builder().withDelegate(MounterCommandFactory.INSTANCE).build());
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+        sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
         sshd.start();
 
         Thread.sleep(Long.MAX_VALUE);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
index 761075b..7f4eaab 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
@@ -137,7 +137,7 @@ public abstract class BaseTestSupport extends Assert {
      * @see #getTargetRelativeFile(Collection)
      */
     protected Path getTempTargetRelativeFile(String ... comps) {
-        return getTempTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.<String>emptyList() : Arrays.asList(comps));
+        return getTempTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.emptyList() : Arrays.asList(comps));
     }
 
     /**
@@ -176,7 +176,7 @@ public abstract class BaseTestSupport extends Assert {
      * @return The {@link Path} representing the result - same as target folder if no components
      */
     protected Path getTargetRelativeFile(String ... comps) {
-        return getTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.<String>emptyList() : Arrays.asList(comps));
+        return getTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.emptyList() : Arrays.asList(comps));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java b/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java
index 637ce43..76a8d5d 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java
@@ -35,10 +35,7 @@ public class EchoShell extends CommandExecutionHelper {
         out.write((command + "\n").getBytes(StandardCharsets.UTF_8));
         out.flush();
 
-        if ("exit".equals(command)) {
-            return false;
-        }
+        return !"exit".equals(command);
 
-        return true;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java b/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java
index bc26a9c..2bca899 100644
--- a/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java
+++ b/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java
@@ -24,10 +24,8 @@ import java.util.Collections;
 
 import com.jcraft.jsch.JSch;
 
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.util.OsUtils;
 import org.apache.sshd.git.transport.GitSshdSessionFactory;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.auth.password.AcceptAllPasswordAuthenticator;
 import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
@@ -73,7 +71,7 @@ public class GitPackCommandTest extends BaseTestSupport {
 
         try (SshServer sshd = setupTestServer()) {
             Path serverRootDir = gitRootDir.resolve("server");
-            sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+            sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
             sshd.setCommandFactory(new GitPackCommandFactory(Utils.resolveRelativeRemotePath(targetParent, serverRootDir)));
             sshd.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java b/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java
index 1898a47..4b4fda8 100644
--- a/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java
+++ b/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java
@@ -29,9 +29,7 @@ import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.channel.ChannelExec;
 import org.apache.sshd.client.channel.ClientChannelEvent;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.util.net.SshdSocketAddress;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
 import org.apache.sshd.util.test.BaseTestSupport;
@@ -60,7 +58,7 @@ public class GitPgmCommandTest extends BaseTestSupport {
         //
 
         try (SshServer sshd = setupTestServer()) {
-            sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+            sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
             sshd.setCommandFactory(new GitPgmCommandFactory(Utils.resolveRelativeRemotePath(targetParent, serverDir)));
             sshd.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java b/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
index 2584ba3..6a3d5a0 100644
--- a/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
+++ b/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
@@ -179,7 +179,7 @@ public class LdapPublickeyAuthenticator extends LdapAuthenticator implements Pub
         }
 
         PublicKey k = parsePublicKeyValue(username, expected, session, attrs, keyData);
-        return (k == null) ? Collections.<PublicKey>emptyList() : Collections.singletonList(k);
+        return (k == null) ? Collections.emptyList() : Collections.singletonList(k);
     }
 
     /**


[07/16] mina-sshd git commit: [SSHD-698] Remove octal integers warning

Posted by gn...@apache.org.
[SSHD-698] Remove octal integers warning

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/6d0d896b
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/6d0d896b
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/6d0d896b

Branch: refs/heads/master
Commit: 6d0d896b2e58faf7c5fc85713a47e62a256ab043
Parents: 195874b
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Sep 15 11:31:56 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Sep 15 21:06:35 2016 +0200

----------------------------------------------------------------------
 sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java   | 1 +
 .../java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java   | 1 +
 2 files changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/6d0d896b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
index 9aaa83e..8c0c17f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
@@ -62,6 +62,7 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
+@SuppressWarnings("OctalInteger")
 public class ScpHelper extends AbstractLoggingBean implements SessionHolder<Session> {
     /**
      * Command prefix used to identify SCP commands

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/6d0d896b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java
index ce64bfb..a9bb8c4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java
@@ -28,6 +28,7 @@ import org.apache.sshd.common.util.logging.LoggingUtils;
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
+@SuppressWarnings("OctalInteger")
 public final class SftpConstants {
     public static final String SFTP_SUBSYSTEM_NAME = "sftp";
 


[05/16] mina-sshd git commit: [SSHD-698] Minor cleanup

Posted by gn...@apache.org.
[SSHD-698] Minor cleanup

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/88046917
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/88046917
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/88046917

Branch: refs/heads/master
Commit: 88046917a05a8ddceadaee47735de652546b342f
Parents: 83fc8d8
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Sep 15 11:24:52 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Sep 15 21:06:28 2016 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/sshd/common/util/SelectorUtils.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/88046917/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
index d34323c..6c343c4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
@@ -810,7 +810,7 @@ public final class SelectorUtils {
         }
 
         // make sure path does not contain the target separator
-        if (path.indexOf(fsSeparator) >= 0) {
+        if (path.contains(fsSeparator)) {
             ValidateUtils.throwIllegalArgumentException("File system replacement may yield ambiguous result for %s with separator=%s", path, fsSeparator);
         }
 
@@ -855,7 +855,7 @@ public final class SelectorUtils {
      * @return a String that has had all whitespace removed.
      */
     public static String removeWhitespace(String input) {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         if (input != null) {
             StringTokenizer st = new StringTokenizer(input);
             while (st.hasMoreTokens()) {


[14/16] mina-sshd git commit: [SSHD-698] Use lambda and method references, streams Deprecate Utils inner classes and use interface methods instead.

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java
index 5574552..dccb426 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java
@@ -18,9 +18,9 @@
  */
 package org.apache.sshd.common;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import org.apache.sshd.common.util.Transformer;
 
@@ -36,6 +36,7 @@ public interface NamedFactory<T> extends Factory<T>, NamedResource {
      * Utility class to help using NamedFactories
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
 
@@ -43,45 +44,51 @@ public interface NamedFactory<T> extends Factory<T>, NamedResource {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * Create an instance of the specified name by looking up the needed factory
-         * in the list.
-         *
-         * @param factories list of available factories
-         * @param name      the factory name to use
-         * @param <T>       type of object to create
-         * @return a newly created object or {@code null} if the factory is not in the list
-         */
         public static <T> T create(Collection<? extends NamedFactory<T>> factories, String name) {
-            NamedFactory<? extends T> f = NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, factories);
-            if (f != null) {
-                return f.create();
-            } else {
-                return null;
-            }
+            return NamedFactory.create(factories, name);
         }
 
         public static <S extends OptionalFeature, T, E extends NamedFactory<T>> List<NamedFactory<T>> setUpTransformedFactories(
                 boolean ignoreUnsupported, Collection<? extends S> preferred, Transformer<? super S, ? extends E> xform) {
-            List<NamedFactory<T>> avail = new ArrayList<>(preferred.size());
-            for (S f : preferred) {
-                if (ignoreUnsupported || f.isSupported()) {
-                    avail.add(xform.transform(f));
-                }
-            }
-            return avail;
+            return NamedFactory.setUpTransformedFactories(ignoreUnsupported, preferred, xform);
         }
 
         public static <T, E extends NamedFactory<T> & OptionalFeature> List<NamedFactory<T>> setUpBuiltinFactories(
                 boolean ignoreUnsupported, Collection<? extends E> preferred) {
-            List<NamedFactory<T>> avail = new ArrayList<>(preferred.size());
-            for (E f : preferred) {
-                if (ignoreUnsupported || f.isSupported()) {
-                    avail.add(f);
-                }
-            }
+            return NamedFactory.setUpBuiltinFactories(ignoreUnsupported, preferred);
+        }
+    }
 
-            return avail;
+    /**
+     * Create an instance of the specified name by looking up the needed factory
+     * in the list.
+     *
+     * @param factories list of available factories
+     * @param name      the factory name to use
+     * @param <T>       type of object to create
+     * @return a newly created object or {@code null} if the factory is not in the list
+     */
+    static <T> T create(Collection<? extends NamedFactory<T>> factories, String name) {
+        NamedFactory<? extends T> f = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, factories);
+        if (f != null) {
+            return f.create();
+        } else {
+            return null;
         }
     }
+
+    static <S extends OptionalFeature, T, E extends NamedFactory<T>> List<NamedFactory<T>> setUpTransformedFactories(
+            boolean ignoreUnsupported, Collection<? extends S> preferred, Transformer<? super S, ? extends E> xform) {
+        return preferred.stream()
+                .filter(f -> ignoreUnsupported || f.isSupported())
+                .map(xform::transform)
+                .collect(Collectors.toList());
+    }
+
+    static <T, E extends NamedFactory<T> & OptionalFeature> List<NamedFactory<T>> setUpBuiltinFactories(
+            boolean ignoreUnsupported, Collection<? extends E> preferred) {
+        return preferred.stream()
+                .filter(f -> ignoreUnsupported || f.isSupported())
+                .collect(Collectors.toList());
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java b/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java
index 87b1e63..6aab4409 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java
@@ -19,9 +19,7 @@
 
 package org.apache.sshd.common;
 
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
@@ -35,31 +33,15 @@ import org.apache.sshd.common.util.Transformer;
 public interface NamedResource {
 
     /**
-     * Compares 2 {@link NamedResource}s according to their {@link #getName()}
-     * value case <U>insensitive</U>
+     * Returns the value of {@link #getName()} - or {@code null} if argument is {@code null}
      */
-    Comparator<NamedResource> BY_NAME_COMPARATOR = new Comparator<NamedResource>() {
-        @Override
-        public int compare(NamedResource r1, NamedResource r2) {
-            String n1 = r1.getName();
-            String n2 = r2.getName();
-            return String.CASE_INSENSITIVE_ORDER.compare(n1, n2);
-        }
-    };
+    Transformer<NamedResource, String> NAME_EXTRACTOR = input -> input == null ? null : input.getName();
 
     /**
-     * Returns the value of {@link #getName()} - or {@code null} if argument is {@code null}
+     * Compares 2 {@link NamedResource}s according to their {@link #getName()}
+     * value case <U>insensitive</U>
      */
-    Transformer<NamedResource, String> NAME_EXTRACTOR = new Transformer<NamedResource, String>() {
-        @Override
-        public String transform(NamedResource input) {
-            if (input == null) {
-                return null;
-            } else {
-                return input.getName();
-            }
-        }
-    };
+    Comparator<NamedResource> BY_NAME_COMPARATOR = Comparator.comparing(NAME_EXTRACTOR, String.CASE_INSENSITIVE_ORDER);
 
     /**
      * @return The resource name
@@ -70,6 +52,7 @@ public interface NamedResource {
      * Utility class to help using {@link NamedResource}s
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
 
@@ -77,74 +60,73 @@ public interface NamedResource {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * @param resources The named resources
-         * @return A {@link List} of all the factories names - in same order
-         * as they appear in the input collection
-         */
         public static List<String> getNameList(Collection<? extends NamedResource> resources) {
-            if (GenericUtils.isEmpty(resources)) {
-                return Collections.emptyList();
-            }
-
-            List<String> names = new ArrayList<>(resources.size());
-            for (NamedResource r : resources) {
-                names.add(r.getName());
-            }
-
-            return names;
+            return NamedResource.getNameList(resources);
         }
 
-        /**
-         * @param resources list of available resources
-         * @return A comma separated list of factory names
-         */
         public static String getNames(Collection<? extends NamedResource> resources) {
-            return GenericUtils.join(getNameList(resources), ',');
+            return NamedResource.getNames(resources);
         }
 
-        /**
-         * Remove the resource identified by the name from the list.
-         *
-         * @param <R>       The generic resource type
-         * @param name      Name of the resource - ignored if {@code null}/empty
-         * @param c         The {@link Comparator} to decide whether the {@link NamedResource#getName()}
-         *                  matches the <tt>name</tt> parameter
-         * @param resources The {@link NamedResource} to check - ignored if {@code null}/empty
-         * @return the removed resource from the list or {@code null} if not in the list
-         */
         public static <R extends NamedResource> R removeByName(String name, Comparator<? super String> c, Collection<? extends R> resources) {
-            R r = findByName(name, c, resources);
-            if (r != null) {
-                resources.remove(r);
-            }
-
-            return r;
+            return NamedResource.removeByName(name, c, resources);
         }
 
-        /**
-         * @param <R>       The generic resource type
-         * @param name      Name of the resource - ignored if {@code null}/empty
-         * @param c         The {@link Comparator} to decide whether the {@link NamedResource#getName()}
-         *                  matches the <tt>name</tt> parameter
-         * @param resources The {@link NamedResource} to check - ignored if {@code null}/empty
-         * @return The <U>first</U> resource whose name matches the parameter (by invoking
-         * {@link Comparator#compare(Object, Object)} - {@code null} if no match found
-         */
         public static <R extends NamedResource> R findByName(String name, Comparator<? super String> c, Collection<? extends R> resources) {
-            if (GenericUtils.isEmpty(name) || GenericUtils.isEmpty(resources)) {
-                return null;
-            }
-
-            for (R r : resources) {
-                String n = r.getName();
-                int nRes = c.compare(name, n);
-                if (nRes == 0) {
-                    return r;
-                }
-            }
-
-            return null;
+            return NamedResource.findByName(name, c, resources);
+        }
+    }
+
+    /**
+     * @param resources The named resources
+     * @return A {@link List} of all the factories names - in same order
+     * as they appear in the input collection
+     */
+    static List<String> getNameList(Collection<? extends NamedResource> resources) {
+        return GenericUtils.map(resources, NamedResource::getName);
+    }
+
+    /**
+     * @param resources list of available resources
+     * @return A comma separated list of factory names
+     */
+    static String getNames(Collection<? extends NamedResource> resources) {
+        return GenericUtils.join(getNameList(resources), ',');
+    }
+
+    /**
+     * Remove the resource identified by the name from the list.
+     *
+     * @param <R>       The generic resource type
+     * @param name      Name of the resource - ignored if {@code null}/empty
+     * @param c         The {@link Comparator} to decide whether the {@link NamedResource#getName()}
+     *                  matches the <tt>name</tt> parameter
+     * @param resources The {@link NamedResource} to check - ignored if {@code null}/empty
+     * @return the removed resource from the list or {@code null} if not in the list
+     */
+    static <R extends NamedResource> R removeByName(String name, Comparator<? super String> c, Collection<? extends R> resources) {
+        R r = findByName(name, c, resources);
+        if (r != null) {
+            resources.remove(r);
         }
+        return r;
+    }
+
+    /**
+     * @param <R>       The generic resource type
+     * @param name      Name of the resource - ignored if {@code null}/empty
+     * @param c         The {@link Comparator} to decide whether the {@link NamedResource#getName()}
+     *                  matches the <tt>name</tt> parameter
+     * @param resources The {@link NamedResource} to check - ignored if {@code null}/empty
+     * @return The <U>first</U> resource whose name matches the parameter (by invoking
+     * {@link Comparator#compare(Object, Object)} - {@code null} if no match found
+     */
+    static <R extends NamedResource> R findByName(String name, Comparator<? super String> c, Collection<? extends R> resources) {
+        return GenericUtils.isEmpty(name)
+            ? null
+            : GenericUtils.stream(resources)
+                .filter(r -> c.compare(name, r.getName()) == 0)
+                .findFirst()
+                .orElse(null);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/OptionalFeature.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/OptionalFeature.java b/sshd-core/src/main/java/org/apache/sshd/common/OptionalFeature.java
index 54ec1b4..6bc6eac 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/OptionalFeature.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/OptionalFeature.java
@@ -58,6 +58,7 @@ public interface OptionalFeature {
      * Utility class to help using {@link OptionalFeature}s
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
 
@@ -66,45 +67,51 @@ public interface OptionalFeature {
         }
 
         public static OptionalFeature of(boolean supported) {
-            return supported ? TRUE : FALSE;
+            return OptionalFeature.of(supported);
         }
 
         public static OptionalFeature all(final Collection<? extends OptionalFeature> features) {
-            return new OptionalFeature() {
-                @Override
-                public boolean isSupported() {
-                    if (GenericUtils.isEmpty(features)) {
-                        return false;
-                    }
-
-                    for (OptionalFeature f : features) {
-                        if (!f.isSupported()) {
-                            return false;
-                        }
-                    }
-
-                    return true;
-                }
-            };
+            return OptionalFeature.all(features);
         }
 
         public static OptionalFeature any(final Collection<? extends OptionalFeature> features) {
-            return new OptionalFeature() {
-                @Override
-                public boolean isSupported() {
-                    if (GenericUtils.isEmpty(features)) {
-                        return false;
-                    }
-
-                    for (OptionalFeature f : features) {
-                        if (f.isSupported()) {
-                            return true;
-                        }
-                    }
+            return OptionalFeature.any(features);
+        }
+    }
 
+    static OptionalFeature of(boolean supported) {
+        return supported ? TRUE : FALSE;
+    }
+
+    static OptionalFeature all(final Collection<? extends OptionalFeature> features) {
+        return () -> {
+            if (GenericUtils.isEmpty(features)) {
+                return false;
+            }
+
+            for (OptionalFeature f : features) {
+                if (!f.isSupported()) {
                     return false;
                 }
-            };
-        }
+            }
+
+            return true;
+        };
+    }
+
+    static OptionalFeature any(final Collection<? extends OptionalFeature> features) {
+        return () -> {
+            if (GenericUtils.isEmpty(features)) {
+                return false;
+            }
+
+            for (OptionalFeature f : features) {
+                if (f.isSupported()) {
+                    return true;
+                }
+            }
+
+            return false;
+        };
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java
index bd08a52..2335074 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java
@@ -30,6 +30,7 @@ public interface ServiceFactory extends NamedResource {
      * Utility class to help using NamedFactories
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
 
@@ -37,24 +38,28 @@ public interface ServiceFactory extends NamedResource {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * Create an instance of the specified name by looking up the needed factory
-         * in the list (case <U>insensitive</U>.
-         *
-         * @param factories list of available factories
-         * @param name      the factory name to use
-         * @param session   the referenced {@link Session}
-         * @return a newly created object or {@code null} if the factory is not in the list
-         * @throws IOException if session creation failed
-         * @see ServiceFactory#create(Session)
-         */
         public static Service create(Collection<? extends ServiceFactory> factories, String name, Session session) throws IOException {
-            ServiceFactory factory = NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, factories);
-            if (factory == null) {
-                return null;
-            } else {
-                return factory.create(session);
-            }
+            return ServiceFactory.create(factories, name, session);
+        }
+    }
+
+    /**
+     * Create an instance of the specified name by looking up the needed factory
+     * in the list (case <U>insensitive</U>.
+     *
+     * @param factories list of available factories
+     * @param name      the factory name to use
+     * @param session   the referenced {@link Session}
+     * @return a newly created object or {@code null} if the factory is not in the list
+     * @throws IOException if session creation failed
+     * @see ServiceFactory#create(Session)
+     */
+    static Service create(Collection<? extends ServiceFactory> factories, String name, Session session) throws IOException {
+        ServiceFactory factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, factories);
+        if (factory == null) {
+            return null;
+        } else {
+            return factory.create(session);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java b/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java
index 4ceb0c3..35205c1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java
@@ -18,12 +18,10 @@
  */
 package org.apache.sshd.common;
 
-import java.lang.reflect.Field;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.function.Predicate;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.logging.LoggingUtils;
@@ -153,19 +151,16 @@ public final class SshConstants {
 
     private static class LazyMessagesMapHolder {
         private static final Map<Integer, String> MESSAGES_MAP =
-                LoggingUtils.generateMnemonicMap(SshConstants.class, new Predicate<Field>() {
-                    @Override
-                    public boolean test(Field f) {
-                        String name = f.getName();
-                        if (!name.startsWith("SSH_MSG_")) {
-                            return false;
-                        }
-
-                        try {
-                            return !isAmbiguousOpcode(f.getByte(null));
-                        } catch (Exception e) {
-                            return false;
-                        }
+                LoggingUtils.generateMnemonicMap(SshConstants.class, f -> {
+                    String name = f.getName();
+                    if (!name.startsWith("SSH_MSG_")) {
+                        return false;
+                    }
+
+                    try {
+                        return !isAmbiguousOpcode(f.getByte(null));
+                    } catch (Exception e) {
+                        return false;
                     }
                 });
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java b/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
index 757f709..6dcb615 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
@@ -19,14 +19,13 @@
 
 package org.apache.sshd.common;
 
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Properties;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.stream.Collectors;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.Pair;
@@ -134,16 +133,12 @@ public final class SyspropsMapWrapper implements Map<String, Object> {
 
     @Override
     public Set<String> keySet() {
-        Properties props = System.getProperties();
-        Set<String> keys = new TreeSet<>();
-        // filter out any non-SSHD properties
-        for (String key : props.stringPropertyNames()) {
-            if (isMappedSyspropKey(key)) {
-                keys.add(getUnmappedSyspropKey(key));
-            }
-        }
-
-        return keys;
+        return System.getProperties()
+                .stringPropertyNames().stream()
+                // filter out any non-SSHD properties
+                .filter(SyspropsMapWrapper::isMappedSyspropKey)
+                .map(SyspropsMapWrapper::getUnmappedSyspropKey)
+                .collect(Collectors.toSet());
     }
 
     @Override
@@ -152,7 +147,7 @@ public final class SyspropsMapWrapper implements Map<String, Object> {
     }
 
     @Override
-    public void putAll(Map<? extends String, ? extends Object> m) {
+    public void putAll(Map<? extends String, ?> m) {
         throw new UnsupportedOperationException("sysprops#putAll(" + m + ") N/A");
     }
 
@@ -170,18 +165,11 @@ public final class SyspropsMapWrapper implements Map<String, Object> {
     public Collection<Object> values() {
         Properties props = System.getProperties();
         // return a copy in order to avoid concurrent modifications
-        List<Object> values = new ArrayList<>(props.size());
-        for (String key : props.stringPropertyNames()) {
-            if (!isMappedSyspropKey(key)) {
-                continue;
-            }
-            Object v = props.getProperty(key);
-            if (v != null) {
-                values.add(v);
-            }
-        }
-
-        return values;
+        return props
+                .stringPropertyNames().stream()
+                .filter(SyspropsMapWrapper::isMappedSyspropKey)
+                .map(props::get)
+                .collect(Collectors.toList());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
index b2e4c1c..d611d1d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
@@ -68,7 +68,7 @@ public abstract class AbstractChannel
     /**
      * Default growth factor function used to resize response buffers
      */
-    public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR = Int2IntFunction.Utils.add(Byte.SIZE);
+    public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR = Int2IntFunction.add(Byte.SIZE);
 
     protected enum GracefulState {
         Opened, CloseSent, CloseReceived, Closed
@@ -125,11 +125,7 @@ public abstract class AbstractChannel
     }
 
     public void addRequestHandlers(Collection<? extends RequestHandler<Channel>> handlers) {
-        if (GenericUtils.size(handlers) > 0) {
-            for (RequestHandler<Channel> h : handlers) {
-                addRequestHandler(h);
-            }
-        }
+        GenericUtils.forEach(handlers, this::addRequestHandler);
     }
 
     public void addRequestHandler(RequestHandler<Channel> handler) {
@@ -505,14 +501,11 @@ public abstract class AbstractChannel
 
                 try {
                     long timeout = PropertyResolverUtils.getLongProperty(channel, FactoryManager.CHANNEL_CLOSE_TIMEOUT, FactoryManager.DEFAULT_CHANNEL_CLOSE_TIMEOUT);
-                    s.writePacket(buffer, timeout, TimeUnit.MILLISECONDS).addListener(new SshFutureListener<IoWriteFuture>() {
-                        @Override
-                        public void operationComplete(IoWriteFuture future) {
-                            if (future.isWritten()) {
-                                handleClosePacketWritten(channel, immediately);
-                            } else {
-                                handleClosePacketWriteFailure(channel, immediately, future.getException());
-                            }
+                    s.writePacket(buffer, timeout, TimeUnit.MILLISECONDS).addListener(future -> {
+                        if (future.isWritten()) {
+                            handleClosePacketWritten(channel, immediately);
+                        } else {
+                            handleClosePacketWriteFailure(channel, immediately, future.getException());
                         }
                     });
                 } catch (IOException e) {
@@ -815,7 +808,7 @@ public abstract class AbstractChannel
 
     @Override
     public <T> T resolveAttribute(AttributeKey<T> key) {
-        return AttributeStore.Utils.resolveAttribute(this, key);
+        return AttributeStore.resolveAttribute(this, key);
     }
 
     protected void configureWindow() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelRequestHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelRequestHandler.java
index 3268469..7fdaf1c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelRequestHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelRequestHandler.java
@@ -28,13 +28,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
 public interface ChannelRequestHandler extends RequestHandler<Channel> {
 
     // required because of generics issues
-    Transformer<ChannelRequestHandler, RequestHandler<Channel>> CHANN2HNDLR =
-        new Transformer<ChannelRequestHandler, RequestHandler<Channel>>() {
-            @Override
-            public RequestHandler<Channel> transform(ChannelRequestHandler input) {
-                return input;
-            }
-        };
+    Transformer<ChannelRequestHandler, RequestHandler<Channel>> CHANN2HNDLR = Transformer.identity();
 
     @Override
     Result process(Channel channel, String request, boolean wantReply, Buffer buffer) throws Exception;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
index 82e3cbf..f8c01c7 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
@@ -20,11 +20,12 @@ package org.apache.sshd.common.channel;
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.EnumMap;
 import java.util.EnumSet;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.function.Function;
 
 import org.apache.sshd.common.util.GenericUtils;
 
@@ -293,15 +294,8 @@ public enum PtyMode {
     public static final Set<PtyMode> MODES = Collections.unmodifiableSet(EnumSet.allOf(PtyMode.class));
 
     private static final Map<Integer, PtyMode> COMMANDS =
-            Collections.unmodifiableMap(new HashMap<Integer, PtyMode>(MODES.size()) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    for (PtyMode c : PtyMode.MODES) {
-                        put(c.toInt(), c);
-                    }
-                }
-            });
+            Collections.unmodifiableMap(
+                    GenericUtils.toSortedMap(MODES, PtyMode::toInt, Function.identity(), Comparator.naturalOrder()));
 
     private int v;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
index b7ee317..650fe55 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
@@ -245,9 +245,7 @@ public final class SttySupport {
      */
     public static String exec(final String cmd)
             throws IOException, InterruptedException {
-        return exec("sh",
-                "-c",
-                cmd);
+        return exec("sh", "-c", cmd);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java
index d85e51d..0ca48ef 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java
@@ -47,13 +47,9 @@ public class Window extends AbstractLoggingBean implements java.nio.channels.Cha
     /**
      * Default {@link Predicate} used to test if space became available
      */
-    public static final Predicate<Window> SPACE_AVAILABLE_PREDICATE = new Predicate<Window>() {
-        @SuppressWarnings("synthetic-access")
-        @Override
-        public boolean test(Window input) {
-            // NOTE: we do not call "getSize()" on purpose in order to avoid the lock
-            return input.sizeHolder.get() > 0;
-        }
+    public static final Predicate<Window> SPACE_AVAILABLE_PREDICATE = input -> {
+        // NOTE: we do not call "getSize()" on purpose in order to avoid the lock
+        return input.sizeHolder.get() > 0;
     };
 
     private final AtomicBoolean closed = new AtomicBoolean(false);
@@ -230,13 +226,9 @@ public class Window extends AbstractLoggingBean implements java.nio.channels.Cha
         checkInitialized("waitAndConsume");
 
         synchronized (lock) {
-            waitForCondition(new Predicate<Window>() {
-                @SuppressWarnings("synthetic-access")
-                @Override
-                public boolean test(Window input) {
-                    // NOTE: we do not call "getSize()" on purpose in order to avoid the lock
-                    return input.sizeHolder.get() >= len;
-                }
+            waitForCondition(input -> {
+                // NOTE: we do not call "getSize()" on purpose in order to avoid the lock
+                return input.sizeHolder.get() >= len;
             }, maxWaitTime);
 
             if (log.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java b/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java
index 409bade..3c3403c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java
@@ -98,7 +98,7 @@ public enum BuiltinCiphers implements CipherFactory {
          * and then the JVM re-started. Therefore, the answer is not going to
          * change while the JVM is running
          */
-        this.supported = Constants.NONE.equals(factoryName) || Cipher.Utils.checkSupported(this.transformation, this.keysize);
+        this.supported = Constants.NONE.equals(factoryName) || Cipher.checkSupported(this.transformation, this.keysize);
     }
 
     @Override
@@ -237,7 +237,7 @@ public enum BuiltinCiphers implements CipherFactory {
      * (case <U>insensitive</U>) the provided name - {@code null} if no match
      */
     public static BuiltinCiphers fromFactoryName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/cipher/Cipher.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/cipher/Cipher.java b/sshd-core/src/main/java/org/apache/sshd/common/cipher/Cipher.java
index 6f35973..dbf7f94 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/cipher/Cipher.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/cipher/Cipher.java
@@ -69,6 +69,7 @@ public interface Cipher extends CipherInformation {
      * Utility class to help using {@link Cipher}s
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
 
@@ -76,26 +77,30 @@ public interface Cipher extends CipherInformation {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * @param xform The full cipher transformation - e.g., AES/CBC/NoPadding -
-         * never {@code null}/empty
-         * @param keyLength The required key length in bits - always positive
-         * @return {@code true} if the cipher transformation <U>and</U> required
-         * key length are supported
-         * @see javax.crypto.Cipher#getMaxAllowedKeyLength(String)
-         */
         public static boolean checkSupported(String xform, int keyLength) {
-            ValidateUtils.checkNotNullAndNotEmpty(xform, "No transformation");
-            if (keyLength <= 0) {
-                throw new IllegalArgumentException("Bad key length (" + keyLength + ") for cipher=" + xform);
-            }
+            return Cipher.checkSupported(xform, keyLength);
+        }
+    }
+
+    /**
+     * @param xform The full cipher transformation - e.g., AES/CBC/NoPadding -
+     * never {@code null}/empty
+     * @param keyLength The required key length in bits - always positive
+     * @return {@code true} if the cipher transformation <U>and</U> required
+     * key length are supported
+     * @see javax.crypto.Cipher#getMaxAllowedKeyLength(String)
+     */
+    static boolean checkSupported(String xform, int keyLength) {
+        ValidateUtils.checkNotNullAndNotEmpty(xform, "No transformation");
+        if (keyLength <= 0) {
+            throw new IllegalArgumentException("Bad key length (" + keyLength + ") for cipher=" + xform);
+        }
 
-            try {
-                int maxKeyLength = javax.crypto.Cipher.getMaxAllowedKeyLength(xform);
-                return maxKeyLength >= keyLength;
-            } catch (Exception e) {
-                return false;
-            }
+        try {
+            int maxKeyLength = javax.crypto.Cipher.getMaxAllowedKeyLength(xform);
+            return maxKeyLength >= keyLength;
+        } catch (Exception e) {
+            return false;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/cipher/ECCurves.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/cipher/ECCurves.java b/sshd-core/src/main/java/org/apache/sshd/common/cipher/ECCurves.java
index dbc2359..9dfd064 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/cipher/ECCurves.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/cipher/ECCurves.java
@@ -24,13 +24,12 @@ import java.security.spec.ECFieldFp;
 import java.security.spec.ECParameterSpec;
 import java.security.spec.ECPoint;
 import java.security.spec.EllipticCurve;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Set;
-import java.util.TreeSet;
+import java.util.stream.Collectors;
 
 import org.apache.sshd.common.NamedResource;
 import org.apache.sshd.common.OptionalFeature;
@@ -103,49 +102,31 @@ public enum ECCurves implements NamedResource, OptionalFeature {
      * A {@link Set} of all the known curves names
      */
     public static final Set<String> NAMES =
-            Collections.unmodifiableSet(new TreeSet<String>(String.CASE_INSENSITIVE_ORDER) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    for (ECCurves c : VALUES) {
-                        add(c.getName());
-                    }
-                }
-            });
+            Collections.unmodifiableSet(GenericUtils.mapSort(
+                    VALUES,
+                    ECCurves::getName,
+                    String.CASE_INSENSITIVE_ORDER));
 
     /**
      * A {@link Set} of all the known curves key types
      */
     public static final Set<String> KEY_TYPES =
-            Collections.unmodifiableSet(new TreeSet<String>(String.CASE_INSENSITIVE_ORDER) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    for (ECCurves c : VALUES) {
-                        add(c.getKeyType());
-                    }
-                }
-            });
-
-    public static final Comparator<ECCurves> BY_KEY_SIZE = new Comparator<ECCurves>() {
-        @Override
-        public int compare(ECCurves o1, ECCurves o2) {
-            int k1 = (o1 == null) ? Integer.MAX_VALUE : o1.getKeySize();
-            int k2 = (o2 == null) ? Integer.MAX_VALUE : o2.getKeySize();
-            return Integer.compare(k1, k2);
-        }
+            Collections.unmodifiableSet(GenericUtils.mapSort(
+                    VALUES,
+                    ECCurves::getKeyType,
+                    String.CASE_INSENSITIVE_ORDER));
+
+    public static final Comparator<ECCurves> BY_KEY_SIZE = (o1, o2) -> {
+        int k1 = (o1 == null) ? Integer.MAX_VALUE : o1.getKeySize();
+        int k2 = (o2 == null) ? Integer.MAX_VALUE : o2.getKeySize();
+        return Integer.compare(k1, k2);
     };
 
     public static final List<ECCurves> SORTED_KEY_SIZE =
-            Collections.unmodifiableList(
-                    new ArrayList<ECCurves>(VALUES) {
-                        // Not serializing it
-                        private static final long serialVersionUID = 1L;
-
-                        {
-                            Collections.sort(this, BY_KEY_SIZE);
-                        }
-                    });
+            Collections.unmodifiableList(VALUES.stream()
+                    .sorted(BY_KEY_SIZE)
+                    .collect(Collectors.toList()));
+
     private final String name;
     private final String keyType;
     private final ECParameterSpec params;
@@ -230,7 +211,7 @@ public enum ECCurves implements NamedResource, OptionalFeature {
      * match found
      */
     public static ECCurves fromCurveName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java b/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java
index 8365226..bf547c9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java
@@ -151,7 +151,7 @@ public enum BuiltinCompressions implements CompressionFactory {
     }
 
     public static BuiltinCompressions fromFactoryName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/config/NamedFactoriesListParseResult.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/NamedFactoriesListParseResult.java b/sshd-core/src/main/java/org/apache/sshd/common/config/NamedFactoriesListParseResult.java
index 4031a74..246cae0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/NamedFactoriesListParseResult.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/NamedFactoriesListParseResult.java
@@ -41,7 +41,7 @@ public abstract class NamedFactoriesListParseResult<T, F extends NamedFactory<T>
 
     @Override
     public String toString() {
-        return "parsed=" + NamedResource.Utils.getNames(getParsedFactories())
+        return "parsed=" + NamedResource.getNames(getParsedFactories())
                 + ";unknown=" + GenericUtils.join(getUnsupportedFactories(), ',');
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/config/NamedResourceListParseResult.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/NamedResourceListParseResult.java b/sshd-core/src/main/java/org/apache/sshd/common/config/NamedResourceListParseResult.java
index 3559d64..feb45f4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/NamedResourceListParseResult.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/NamedResourceListParseResult.java
@@ -51,7 +51,7 @@ public abstract class NamedResourceListParseResult<R extends NamedResource> exte
 
     @Override
     public String toString() {
-        return "parsed=" + NamedResource.Utils.getNames(getParsedResources())
+        return "parsed=" + NamedResource.getNames(getParsedResources())
                 + ";unknown=" + GenericUtils.join(getUnsupportedResources(), ',');
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java b/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
index 27a42a2..c11c865 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
@@ -501,7 +501,7 @@ public final class SshConfigFileReader {
         ValidateUtils.checkTrue(lenient || GenericUtils.isEmpty(unsupported), "Unsupported cipher(s) (%s) in %s", unsupported, value);
 
         List<NamedFactory<Cipher>> factories =
-                BuiltinFactory.Utils.setUpFactories(ignoreUnsupported, result.getParsedFactories());
+                BuiltinFactory.setUpFactories(ignoreUnsupported, result.getParsedFactories());
         manager.setCipherFactories(ValidateUtils.checkNotNullAndNotEmpty(factories, "No known/unsupported ciphers(s): %s", value));
         return manager;
     }
@@ -519,7 +519,7 @@ public final class SshConfigFileReader {
         ValidateUtils.checkTrue(lenient || GenericUtils.isEmpty(unsupported), "Unsupported signatures (%s) in %s", unsupported, value);
 
         List<NamedFactory<Signature>> factories =
-                BuiltinFactory.Utils.setUpFactories(ignoreUnsupported, result.getParsedFactories());
+                BuiltinFactory.setUpFactories(ignoreUnsupported, result.getParsedFactories());
         manager.setSignatureFactories(ValidateUtils.checkNotNullAndNotEmpty(factories, "No known/supported signatures: %s", value));
         return manager;
     }
@@ -537,7 +537,7 @@ public final class SshConfigFileReader {
         ValidateUtils.checkTrue(lenient || GenericUtils.isEmpty(unsupported), "Unsupported MAC(s) (%s) in %s", unsupported, value);
 
         List<NamedFactory<Mac>> factories =
-                BuiltinFactory.Utils.setUpFactories(ignoreUnsupported, result.getParsedFactories());
+                BuiltinFactory.setUpFactories(ignoreUnsupported, result.getParsedFactories());
         manager.setMacFactories(ValidateUtils.checkNotNullAndNotEmpty(factories, "No known/supported MAC(s): %s", value));
         return manager;
     }
@@ -573,7 +573,7 @@ public final class SshConfigFileReader {
         ValidateUtils.checkTrue(lenient || GenericUtils.isEmpty(unsupported), "Unsupported KEX(s) (%s) in %s", unsupported, value);
 
         List<NamedFactory<KeyExchange>> factories =
-                NamedFactory.Utils.setUpTransformedFactories(ignoreUnsupported, result.getParsedFactories(), xformer);
+                NamedFactory.setUpTransformedFactories(ignoreUnsupported, result.getParsedFactories(), xformer);
         manager.setKeyExchangeFactories(ValidateUtils.checkNotNullAndNotEmpty(factories, "No known/supported KEXS(s): %s", value));
         return manager;
     }
@@ -621,7 +621,7 @@ public final class SshConfigFileReader {
             ValidateUtils.checkTrue(lenient || GenericUtils.isEmpty(unsupported), "Unsupported compressions(s) (%s) in %s", unsupported, value);
 
             List<NamedFactory<Compression>> factories =
-                    BuiltinFactory.Utils.setUpFactories(ignoreUnsupported, result.getParsedFactories());
+                    BuiltinFactory.setUpFactories(ignoreUnsupported, result.getParsedFactories());
             // SSH can work without compression
             if (GenericUtils.size(factories) > 0) {
                 manager.setCompressionFactories(factories);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/config/keys/BuiltinIdentities.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/BuiltinIdentities.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/BuiltinIdentities.java
index f63ca5e..7a3623b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/BuiltinIdentities.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/BuiltinIdentities.java
@@ -33,7 +33,6 @@ import java.util.Collections;
 import java.util.EnumSet;
 import java.util.Objects;
 import java.util.Set;
-import java.util.TreeSet;
 
 import org.apache.sshd.common.NamedResource;
 import org.apache.sshd.common.util.GenericUtils;
@@ -56,13 +55,9 @@ public enum BuiltinIdentities implements Identity {
             Collections.unmodifiableSet(EnumSet.allOf(BuiltinIdentities.class));
 
     public static final Set<String> NAMES =
-            Collections.unmodifiableSet(new TreeSet<String>(String.CASE_INSENSITIVE_ORDER) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    addAll(NamedResource.Utils.getNameList(VALUES));
-                }
-            });
+            Collections.unmodifiableSet(GenericUtils.asSortedSet(
+                        String.CASE_INSENSITIVE_ORDER,
+                        NamedResource.getNameList(VALUES)));
 
     private final String name;
     private final String algorithm;
@@ -111,7 +106,7 @@ public enum BuiltinIdentities implements Identity {
      * value matches case <U>insensitive</U> or {@code null} if no match found
      */
     public static BuiltinIdentities fromName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/config/keys/KeyUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/KeyUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/KeyUtils.java
index 5dc90ef..c06f9e9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/KeyUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/KeyUtils.java
@@ -296,6 +296,7 @@ public final class KeyUtils {
             for (String n : names) {
                 PublicKeyEntryDecoder<?, ?> prev = BY_KEY_TYPE_DECODERS_MAP.put(n, decoder);
                 if (prev != null) {
+                    //noinspection UnnecessaryContinue
                     continue;   // debug breakpoint
                 }
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/config/keys/PublicKeyEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/PublicKeyEntry.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/PublicKeyEntry.java
index 5ea14aa..6897338 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/PublicKeyEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/PublicKeyEntry.java
@@ -172,7 +172,7 @@ public class PublicKeyEntry implements Serializable {
      * @throws IllegalArgumentException if bad format found
      * @see #parsePublicKeyEntry(PublicKeyEntry, String)
      */
-    public static final PublicKeyEntry parsePublicKeyEntry(String data) throws IllegalArgumentException {
+    public static PublicKeyEntry parsePublicKeyEntry(String data) throws IllegalArgumentException {
         if (GenericUtils.isEmpty(data)) {
             return null;
         } else {
@@ -189,7 +189,7 @@ public class PublicKeyEntry implements Serializable {
      * @return The updated entry instance
      * @throws IllegalArgumentException if bad format found
      */
-    public static final <E extends PublicKeyEntry> E parsePublicKeyEntry(E entry, String data) throws IllegalArgumentException {
+    public static <E extends PublicKeyEntry> E parsePublicKeyEntry(E entry, String data) throws IllegalArgumentException {
         if (GenericUtils.isEmpty(data) || (entry == null)) {
             return entry;
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/digest/BuiltinDigests.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/digest/BuiltinDigests.java b/sshd-core/src/main/java/org/apache/sshd/common/digest/BuiltinDigests.java
index 01ed09a..a600419 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/digest/BuiltinDigests.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/digest/BuiltinDigests.java
@@ -130,7 +130,7 @@ public enum BuiltinDigests implements DigestFactory {
      * (case <U>insensitive</U>) the provided name - {@code null} if no match
      */
     public static BuiltinDigests fromFactoryName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java b/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
index 367a12e..8755593 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
@@ -146,12 +146,9 @@ public abstract class BaseFileSystem<T extends Path> extends FileSystem {
         }
 
         final Pattern regex = Pattern.compile(expr);
-        return new PathMatcher() {
-            @Override
-            public boolean matches(Path path) {
-                Matcher m = regex.matcher(path.toString());
-                return m.matches();
-            }
+        return path -> {
+            Matcher m = regex.matcher(path.toString());
+            return m.matches();
         };
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/file/util/MockFileSystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/util/MockFileSystem.java b/sshd-core/src/main/java/org/apache/sshd/common/file/util/MockFileSystem.java
index 50eba2e..9181c2d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/file/util/MockFileSystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/file/util/MockFileSystem.java
@@ -52,6 +52,7 @@ public class MockFileSystem extends FileSystem {
     @Override
     public void close() throws IOException {
         if (open.getAndSet(false)) {
+            //noinspection UnnecessaryReturnStatement
             return; // debug breakpoint
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java
index 48c8e1c..b774b37 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java
@@ -33,7 +33,6 @@ import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.client.channel.ClientChannelEvent;
-import org.apache.sshd.client.future.OpenFuture;
 import org.apache.sshd.common.Closeable;
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.FactoryManager;
@@ -41,7 +40,6 @@ import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.RuntimeSshException;
 import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.SshException;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.io.IoAcceptor;
 import org.apache.sshd.common.io.IoHandler;
 import org.apache.sshd.common.io.IoHandlerFactory;
@@ -86,23 +84,13 @@ public class DefaultTcpipForwarder
             Collections.unmodifiableSet(EnumSet.of(ClientChannelEvent.OPENED, ClientChannelEvent.CLOSED));
 
     private final ConnectionService service;
-    private final IoHandlerFactory socksProxyIoHandlerFactory = new IoHandlerFactory() {
-        @Override
-        public IoHandler create() {
-            return new SocksProxy(getConnectionService());
-        }
-    };
+    private final IoHandlerFactory socksProxyIoHandlerFactory = () -> new SocksProxy(getConnectionService());
     private final Session sessionInstance;
     private final Map<Integer, SshdSocketAddress> localToRemote = new HashMap<>();
     private final Map<Integer, SshdSocketAddress> remoteToLocal = new HashMap<>();
     private final Map<Integer, SocksProxy> dynamicLocal = new HashMap<>();
     private final Set<LocalForwardingEntry> localForwards = new HashSet<>();
-    private final IoHandlerFactory staticIoHandlerFactory = new IoHandlerFactory() {
-        @Override
-        public IoHandler create() {
-            return new StaticIoHandler();
-        }
-    };
+    private final IoHandlerFactory staticIoHandlerFactory = StaticIoHandler::new;
     private final Collection<PortForwardingEventListener> listeners =
             EventListenerUtils.synchronizedListenersSet();
     private final PortForwardingEventListener listenerProxy;
@@ -586,19 +574,16 @@ public class DefaultTcpipForwarder
             session.setAttribute(TcpipClientChannel.class, channel);
 
             service.registerChannel(channel);
-            channel.open().addListener(new SshFutureListener<OpenFuture>() {
-                @Override
-                public void operationComplete(OpenFuture future) {
-                    Throwable t = future.getException();
-                    if (t != null) {
-                        log.warn("Failed ({}) to open channel for session={}: {}",
-                                 t.getClass().getSimpleName(), session, t.getMessage());
-                        if (log.isDebugEnabled()) {
-                            log.debug("sessionCreated(" + session + ") channel=" + channel + " open failure details", t);
-                        }
-                        DefaultTcpipForwarder.this.service.unregisterChannel(channel);
-                        channel.close(false);
+            channel.open().addListener(future -> {
+                Throwable t = future.getException();
+                if (t != null) {
+                    log.warn("Failed ({}) to open channel for session={}: {}",
+                             t.getClass().getSimpleName(), session, t.getMessage());
+                    if (log.isDebugEnabled()) {
+                        log.debug("sessionCreated(" + session + ") channel=" + channel + " open failure details", t);
                     }
+                    DefaultTcpipForwarder.this.service.unregisterChannel(channel);
+                    channel.close(false);
                 }
             });
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/forward/LocalForwardingEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/LocalForwardingEntry.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/LocalForwardingEntry.java
index b45562e..f08afc9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/LocalForwardingEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/LocalForwardingEntry.java
@@ -72,7 +72,7 @@ public class LocalForwardingEntry extends SshdSocketAddress {
      * @return The <U>first</U> entry whose host or alias matches the host name - case
      * <U>sensitive</U> <B>and</B> has a matching port - {@code null} if no match found
      */
-    public static final LocalForwardingEntry findMatchingEntry(String host, int port, Collection<? extends LocalForwardingEntry> entries) {
+    public static LocalForwardingEntry findMatchingEntry(String host, int port, Collection<? extends LocalForwardingEntry> entries) {
         if (GenericUtils.isEmpty(host) || (port <= 0) || (GenericUtils.isEmpty(entries))) {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
index 9a04394..5e38e01 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
@@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.sshd.client.future.OpenFuture;
 import org.apache.sshd.common.SshException;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.io.IoHandler;
 import org.apache.sshd.common.io.IoSession;
 import org.apache.sshd.common.session.ConnectionService;
@@ -154,12 +153,7 @@ public class SocksProxy extends AbstractCloseable implements IoHandler {
                 SshdSocketAddress remote = new SshdSocketAddress(host, port);
                 channel = new TcpipClientChannel(TcpipClientChannel.Type.Direct, session, remote);
                 service.registerChannel(channel);
-                channel.open().addListener(new SshFutureListener<OpenFuture>() {
-                    @Override
-                    public void operationComplete(OpenFuture future) {
-                        onChannelOpened(future);
-                    }
-                });
+                channel.open().addListener(this::onChannelOpened);
             } else {
                 super.onMessage(buffer);
             }
@@ -271,12 +265,7 @@ public class SocksProxy extends AbstractCloseable implements IoHandler {
                 SshdSocketAddress remote = new SshdSocketAddress(host, port);
                 channel = new TcpipClientChannel(TcpipClientChannel.Type.Direct, session, remote);
                 service.registerChannel(channel);
-                channel.open().addListener(new SshFutureListener<OpenFuture>() {
-                    @Override
-                    public void operationComplete(OpenFuture future) {
-                        onChannelOpened(future);
-                    }
-                });
+                channel.open().addListener(this::onChannelOpened);
             } else {
                 log.debug("Received socks5 connection message");
                 super.onMessage(buffer);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java
index 2d8d1f1..ac1507f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java
@@ -43,8 +43,8 @@ public abstract class AbstractOpenSshHostKeysHandler extends AbstractConnectionS
 
     protected AbstractOpenSshHostKeysHandler(String request) {
         // TODO use only the default parser once ED25519 implementation is complete (see SSHD-440)
-        this(request, BufferPublicKeyParser.Utils.aggregate(Arrays.asList(
-                            BufferPublicKeyParser.Utils.DEFAULT,
+        this(request, BufferPublicKeyParser.aggregate(Arrays.asList(
+                            BufferPublicKeyParser.DEFAULT,
                             ED25519BufferPublicKeyParser.IGNORING
                     )));
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
index 415d101..80cb8c4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
@@ -154,7 +154,7 @@ public abstract class AbstractFactoryManager extends AbstractKexFactoryManager i
 
     @Override
     public <T> T resolveAttribute(AttributeKey<T> key) {
-        return AttributeStore.Utils.resolveAttribute(this, key);
+        return AttributeStore.resolveAttribute(this, key);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java b/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java
index ba0d014..1310735 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java
@@ -68,7 +68,7 @@ public enum BuiltinIoServiceFactoryFactories implements NamedFactory<IoServiceFa
     }
 
     public static BuiltinIoServiceFactoryFactories fromFactoryName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     public static BuiltinIoServiceFactoryFactories fromFactoryClass(Class<?> clazz) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaConnector.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaConnector.java b/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaConnector.java
index e2e0eab..176d565 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaConnector.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaConnector.java
@@ -105,16 +105,13 @@ public class MinaConnector extends MinaService implements org.apache.sshd.common
             }
         }
         final IoConnectFuture future = new Future(null);
-        getConnector().connect(address).addListener(new IoFutureListener<ConnectFuture>() {
-            @Override
-            public void operationComplete(ConnectFuture cf) {
-                if (cf.getException() != null) {
-                    future.setException(cf.getException());
-                } else if (cf.isCanceled()) {
-                    future.cancel();
-                } else {
-                    future.setSession(getSession(cf.getSession()));
-                }
+        getConnector().connect(address).addListener((IoFutureListener<ConnectFuture>) cf -> {
+            if (cf.getException() != null) {
+                future.setException(cf.getException());
+            } else if (cf.isCanceled()) {
+                future.cancel();
+            } else {
+                future.setSession(getSession(cf.getSession()));
             }
         });
         return future;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaSession.java b/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaSession.java
index b03da53..a6e254d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/io/mina/MinaSession.java
@@ -21,7 +21,6 @@ package org.apache.sshd.common.io.mina;
 import java.net.SocketAddress;
 
 import org.apache.mina.core.buffer.IoBuffer;
-import org.apache.mina.core.future.IoFuture;
 import org.apache.mina.core.future.IoFutureListener;
 import org.apache.mina.core.future.WriteFuture;
 import org.apache.sshd.common.Closeable;
@@ -116,12 +115,7 @@ public class MinaSession extends AbstractInnerCloseable implements IoSession {
             @Override
             public org.apache.sshd.common.future.CloseFuture close(boolean immediately) {
                 org.apache.mina.core.future.CloseFuture cf = immediately ? session.closeNow() : session.closeOnFlush();
-                cf.addListener(new IoFutureListener<IoFuture>() {
-                    @Override
-                    public void operationComplete(IoFuture f) {
-                        future.setValue(Boolean.TRUE);
-                    }
-                });
+                cf.addListener(f -> future.setValue(Boolean.TRUE));
                 return future;
             }
         };
@@ -145,15 +139,12 @@ public class MinaSession extends AbstractInnerCloseable implements IoSession {
     // NOTE !!! data buffer may NOT be re-used when method returns - at least until IoWriteFuture is signalled
     public IoWriteFuture write(IoBuffer buffer) {
         final Future future = new Future(null);
-        session.write(buffer).addListener(new IoFutureListener<WriteFuture>() {
-            @Override
-            public void operationComplete(WriteFuture cf) {
-                Throwable t = cf.getException();
-                if (t != null) {
-                    future.setException(t);
-                } else {
-                    future.setWritten();
-                }
+        session.write(buffer).addListener((IoFutureListener<WriteFuture>) cf -> {
+            Throwable t = cf.getException();
+            if (t != null) {
+                future.setException(t);
+            } else {
+                future.setWritten();
             }
         });
         return future;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2CompletionHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2CompletionHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2CompletionHandler.java
index 9867097..1ed9286 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2CompletionHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2CompletionHandler.java
@@ -34,23 +34,17 @@ public abstract class Nio2CompletionHandler<V, A> implements CompletionHandler<V
 
     @Override
     public void completed(final V result, final A attachment) {
-        AccessController.doPrivileged(new PrivilegedAction<Object>() {
-            @Override
-            public Object run() {
-                onCompleted(result, attachment);
-                return null;
-            }
+        AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
+            onCompleted(result, attachment);
+            return null;
         });
     }
 
     @Override
     public void failed(final Throwable exc, final A attachment) {
-        AccessController.doPrivileged(new PrivilegedAction<Object>() {
-            @Override
-            public Object run() {
-                onFailed(exc, attachment);
-                return null;
-            }
+        AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
+            onFailed(exc, attachment);
+            return null;
         });
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Service.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Service.java b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Service.java
index 080369a..805b9bd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Service.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Service.java
@@ -40,7 +40,6 @@ import org.apache.sshd.common.io.IoSession;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.closeable.AbstractInnerCloseable;
-import org.apache.sshd.common.util.closeable.CloseableUtils;
 
 /**
  */
@@ -76,7 +75,7 @@ public abstract class Nio2Service extends AbstractInnerCloseable implements IoSe
 
     public void dispose() {
         try {
-            long maxWait = CloseableUtils.getMaxCloseWaitTime(getFactoryManager());
+            long maxWait = Closeable.getMaxCloseWaitTime(getFactoryManager());
             boolean successful = close(true).await(maxWait);
             if (!successful) {
                 throw new SocketTimeoutException("Failed to receive closure confirmation within " + maxWait + " millis");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
index a139fa6..5f09c49 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
@@ -234,7 +234,7 @@ public enum BuiltinDHFactories implements DHFactory {
      * or {@code null} if no match found
      */
     public static BuiltinDHFactories fromFactoryName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/kex/DHG.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/DHG.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/DHG.java
index 6a7042f..1f8908c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/DHG.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/DHG.java
@@ -23,6 +23,7 @@ import java.security.KeyFactory;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.PublicKey;
+
 import javax.crypto.KeyAgreement;
 import javax.crypto.spec.DHParameterSpec;
 import javax.crypto.spec.DHPublicKeySpec;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
index cce5cd1..1559858 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
@@ -57,10 +57,10 @@ public interface KexFactoryManager extends KeyPairProviderHolder, SignatureFacto
      */
     List<NamedFactory<Cipher>> getCipherFactories();
     default String getCipherFactoriesNameList() {
-        return NamedResource.Utils.getNames(getCipherFactories());
+        return NamedResource.getNames(getCipherFactories());
     }
     default List<String> getCipherFactoriesNames() {
-        return NamedResource.Utils.getNameList(getCipherFactories());
+        return NamedResource.getNameList(getCipherFactories());
     }
 
     void setCipherFactories(List<NamedFactory<Cipher>> cipherFactories);
@@ -87,10 +87,10 @@ public interface KexFactoryManager extends KeyPairProviderHolder, SignatureFacto
      */
     List<NamedFactory<Compression>> getCompressionFactories();
     default String getCompressionFactoriesNameList() {
-        return NamedResource.Utils.getNames(getCompressionFactories());
+        return NamedResource.getNames(getCompressionFactories());
     }
     default List<String> getCompressionFactoriesNames() {
-        return NamedResource.Utils.getNameList(getCompressionFactories());
+        return NamedResource.getNameList(getCompressionFactories());
     }
 
     void setCompressionFactories(List<NamedFactory<Compression>> compressionFactories);
@@ -117,10 +117,10 @@ public interface KexFactoryManager extends KeyPairProviderHolder, SignatureFacto
      */
     List<NamedFactory<Mac>> getMacFactories();
     default String getMacFactoriesNameList() {
-        return NamedResource.Utils.getNames(getMacFactories());
+        return NamedResource.getNames(getMacFactories());
     }
     default List<String> getMacFactoriesNames() {
-        return NamedResource.Utils.getNameList(getMacFactories());
+        return NamedResource.getNameList(getMacFactories());
     }
 
     void setMacFactories(List<NamedFactory<Mac>> macFactories);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java
index 3216a71..da6278a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java
@@ -19,11 +19,11 @@
 
 package org.apache.sshd.common.kex;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.EnumSet;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import org.apache.sshd.common.util.GenericUtils;
 
@@ -43,34 +43,24 @@ public enum KexProposalOption {
     S2CLANG(Constants.PROPOSAL_LANG_STOC, "languages (server to client)");
 
     /**
+     * Compares values according to {@link KexProposalOption#getProposalIndex()}
+     */
+    public static final Comparator<KexProposalOption> BY_PROPOSAL_INDEX =
+            Comparator.comparingInt(KexProposalOption::getProposalIndex);
+
+    /**
      * A {@link List} of all the options <U>sorted</U> according to {@link #getProposalIndex()}
      *
      * @see #BY_PROPOSAL_INDEX
      */
     public static final List<KexProposalOption> VALUES =
-        Collections.unmodifiableList(new ArrayList<KexProposalOption>(EnumSet.allOf(KexProposalOption.class)) {
-            private static final long serialVersionUID = 1L;    // we're not serializing it
-
-            {
-                Collections.sort(this, BY_PROPOSAL_INDEX);
-            }
-        });
+        Collections.unmodifiableList(
+                EnumSet.allOf(KexProposalOption.class).stream()
+                        .sorted(BY_PROPOSAL_INDEX)
+                        .collect(Collectors.toList()));
 
     public static final int PROPOSAL_MAX = VALUES.size();
 
-    /**
-     * Compares values according to {@link KexProposalOption#getProposalIndex()}
-     */
-    public static final Comparator<KexProposalOption> BY_PROPOSAL_INDEX =
-        new Comparator<KexProposalOption>() {
-            @Override
-            public int compare(KexProposalOption o1, KexProposalOption o2) {
-                int i1 = (o1 == null) ? -1 : o1.getProposalIndex();
-                int i2 = (o2 == null) ? -1 : o2.getProposalIndex();
-                return Integer.compare(i1, i2);
-            }
-        };
-
     private final int proposalIndex;
 
     private final String description;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java
index bd5f7ed..7930f69 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java
@@ -36,6 +36,12 @@ import org.apache.sshd.common.util.logging.LoggingUtils;
  */
 public interface KeyExchange extends NamedResource {
 
+    Map<Integer, String> GROUP_KEX_OPCODES_MAP =
+            LoggingUtils.generateMnemonicMap(SshConstants.class, "SSH_MSG_KEX_DH_GEX_");
+
+    Map<Integer, String> SIMPLE_KEX_OPCODES_MAP =
+            LoggingUtils.generateMnemonicMap(SshConstants.class, "SSH_MSG_KEXDH_");
+
     /**
      * Initialize the key exchange algorithm.
      *
@@ -91,33 +97,44 @@ public interface KeyExchange extends NamedResource {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
+
         public static final Map<Integer, String> GROUP_KEX_OPCODES_MAP =
-                LoggingUtils.generateMnemonicMap(SshConstants.class, "SSH_MSG_KEX_DH_GEX_");
+                KeyExchange.GROUP_KEX_OPCODES_MAP;
+
         public static final Map<Integer, String> SIMPLE_KEX_OPCODES_MAP =
-                LoggingUtils.generateMnemonicMap(SshConstants.class, "SSH_MSG_KEXDH_");
+                KeyExchange.SIMPLE_KEX_OPCODES_MAP;
 
         private Utils() {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
         public static String getGroupKexOpcodeName(int cmd) {
-            String name = GROUP_KEX_OPCODES_MAP.get(cmd);
-            if (GenericUtils.isEmpty(name)) {
-                return SshConstants.getCommandMessageName(cmd);
-            } else {
-                return name;
-            }
+            return KeyExchange.getGroupKexOpcodeName(cmd);
         }
 
         public static String getSimpleKexOpcodeName(int cmd) {
-            String name = SIMPLE_KEX_OPCODES_MAP.get(cmd);
-            if (GenericUtils.isEmpty(name)) {
-                return SshConstants.getCommandMessageName(cmd);
-            } else {
-                return name;
-            }
+            return KeyExchange.getSimpleKexOpcodeName(cmd);
+        }
+    }
+
+    static String getGroupKexOpcodeName(int cmd) {
+        String name = GROUP_KEX_OPCODES_MAP.get(cmd);
+        if (GenericUtils.isEmpty(name)) {
+            return SshConstants.getCommandMessageName(cmd);
+        } else {
+            return name;
+        }
+    }
+
+    static String getSimpleKexOpcodeName(int cmd) {
+        String name = SIMPLE_KEX_OPCODES_MAP.get(cmd);
+        if (GenericUtils.isEmpty(name)) {
+            return SshConstants.getCommandMessageName(cmd);
+        } else {
+            return name;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
index 1991e99..8d36508 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
@@ -25,10 +25,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.security.GeneralSecurityException;
 import java.security.KeyPair;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.io.IoUtils;
@@ -53,27 +50,12 @@ public abstract class AbstractFileKeyPairProvider extends AbstractResourceKeyPai
     }
 
     public void setFiles(Collection<File> files) {
-        if (GenericUtils.isEmpty(files)) {
-            setPaths(Collections.emptyList());
-        } else {
-            List<Path> paths = new ArrayList<>(files.size());
-            for (File f : files) {
-                paths.add(f.toPath());
-            }
-            setPaths(paths);
-        }
+        setPaths(GenericUtils.map(files, File::toPath));
     }
 
     public void setPaths(Collection<? extends Path> paths) {
-        int numPaths = GenericUtils.size(paths);
-        Collection<Path> resolved = (numPaths <= 0) ? Collections.emptyList() : new ArrayList<>(paths.size());
         // use absolute path in order to have unique cache keys
-        if (numPaths > 0) {
-            for (Path p : paths) {
-                resolved.add(p.toAbsolutePath());
-            }
-        }
-
+        Collection<Path> resolved = GenericUtils.map(paths, Path::toAbsolutePath);
         resetCacheMap(resolved);
         files = resolved;
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractKeyPairProvider.java
index 5ce1eae..5cd13c1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractKeyPairProvider.java
@@ -18,13 +18,6 @@
  */
 package org.apache.sshd.common.keyprovider;
 
-import java.security.KeyPair;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.sshd.common.config.keys.KeyUtils;
-import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
 
 /**
@@ -33,37 +26,9 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public abstract class AbstractKeyPairProvider extends AbstractLoggingBean implements KeyPairProvider {
-    // TODO move this code as default interface methods in Java-8
+
     protected AbstractKeyPairProvider() {
         super();
     }
 
-    @Override
-    public KeyPair loadKey(String type) {
-        ValidateUtils.checkNotNullAndNotEmpty(type, "No key type to load");
-
-        Iterable<KeyPair> keys = loadKeys();
-        for (KeyPair key : keys) {
-            String keyType = KeyUtils.getKeyType(key);
-            if (type.equals(keyType)) {
-                return key;
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public List<String> getKeyTypes() {
-        List<String> types = new ArrayList<>();
-        Iterable<KeyPair> keys = loadKeys();
-        for (KeyPair key : keys) {
-            String type = KeyUtils.getKeyType(key);
-            if (GenericUtils.isEmpty(type) || types.contains(type)) {
-                continue;
-            }
-            types.add(type);
-        }
-
-        return types;
-    }
 }


[08/16] mina-sshd git commit: [SSHD-698] Fix typos

Posted by gn...@apache.org.
[SSHD-698] Fix typos

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/0fde8856
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/0fde8856
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/0fde8856

Branch: refs/heads/master
Commit: 0fde8856223441d6889a989e66599d57d2423195
Parents: 6d0d896
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Sep 15 16:31:36 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Sep 15 21:06:39 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/sshd/agent/common/AbstractAgentClient.java | 4 ++--
 .../main/java/org/apache/sshd/client/ClientFactoryManager.java | 2 +-
 .../org/apache/sshd/client/channel/AbstractClientChannel.java  | 4 ++--
 .../main/java/org/apache/sshd/client/channel/ChannelShell.java | 2 +-
 .../java/org/apache/sshd/client/channel/ChannelSubsystem.java  | 2 +-
 .../apache/sshd/client/config/hosts/KnownHostHashValue.java    | 2 +-
 .../sshd/client/keyverifier/KnownHostsServerKeyVerifier.java   | 4 ++--
 .../java/org/apache/sshd/client/scp/AbstractScpClient.java     | 2 +-
 .../sshd/client/session/ClientConnectionServiceFactory.java    | 2 +-
 .../org/apache/sshd/client/session/ClientUserAuthService.java  | 2 +-
 .../client/subsystem/sftp/AbstractSftpFileAttributeView.java   | 2 +-
 .../apache/sshd/client/subsystem/sftp/DefaultSftpClient.java   | 2 +-
 .../sshd/client/subsystem/sftp/SftpDirEntryIterator.java       | 4 ++--
 .../subsystem/sftp/extensions/SpaceAvailableExtension.java     | 2 +-
 sshd-core/src/main/java/org/apache/sshd/common/Factory.java    | 2 +-
 .../src/main/java/org/apache/sshd/common/SshConstants.java     | 4 ++--
 .../org/apache/sshd/common/config/SshConfigFileReader.java     | 2 +-
 .../sshd/common/config/keys/DSSPublicKeyEntryDecoder.java      | 2 +-
 .../apache/sshd/common/config/keys/RSAPublicKeyDecoder.java    | 2 +-
 .../java/org/apache/sshd/common/file/util/BaseFileSystem.java  | 2 +-
 .../sshd/common/global/AbstractOpenSshHostKeysHandler.java     | 2 +-
 .../org/apache/sshd/common/scp/ScpTransferEventListener.java   | 4 ++--
 .../main/java/org/apache/sshd/common/util/EventNotifier.java   | 2 +-
 .../java/org/apache/sshd/server/channel/ChannelSession.java    | 2 +-
 .../org/apache/sshd/server/global/TcpipForwardHandler.java     | 2 +-
 .../org/apache/sshd/server/session/AbstractServerSession.java  | 2 +-
 .../org/apache/sshd/server/session/ServerUserAuthService.java  | 2 +-
 .../java/org/apache/sshd/server/subsystem/sftp/FileHandle.java | 2 +-
 .../org/apache/sshd/server/x11/DefaultX11ForwardSupport.java   | 6 +++---
 .../src/test/java/org/apache/sshd/common/SshConstantsTest.java | 4 ++--
 .../test/java/org/apache/sshd/common/kex/KeyExchangeTest.java  | 2 +-
 31 files changed, 40 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java b/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java
index 796cbdd..abd121f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java
@@ -47,7 +47,7 @@ public abstract class AbstractAgentClient extends AbstractLoggingBean {
         int avail = buffer.available();
         if (avail < 4) {
             if (log.isTraceEnabled()) {
-                log.trace("Received message total length ({}) below minuimum ({})",
+                log.trace("Received message total length ({}) below minimum ({})",
                         avail, 4);
             }
             return;
@@ -60,7 +60,7 @@ public abstract class AbstractAgentClient extends AbstractLoggingBean {
         avail = buffer.available();
         if (avail < (len + 4)) {
             if (log.isTraceEnabled()) {
-                log.trace("Received request length ({}) below minuimum ({})",
+                log.trace("Received request length ({}) below minimum ({})",
                         avail, len + 4);
             }
             return;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java
index e4e873f..3ecdb42 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java
@@ -49,7 +49,7 @@ public interface ClientFactoryManager
     /**
      * Key used to set the heartbeat interval in milliseconds (0 to disable = default)
      */
-    String HEARTBEAT_INTERVAL = "hearbeat-interval";
+    String HEARTBEAT_INTERVAL = "heartbeat-interval";
 
     /**
      * Default value for {@link #HEARTBEAT_INTERVAL} if none configured

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
index e9a8196..24c9983 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
@@ -191,8 +191,8 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
                         // Close inverted streams after
                         // If the inverted stream is closed before, there's a small time window
                         // in which we have:
-                        //    ChannePipedInputStream#closed = true
-                        //    ChannePipedInputStream#writerClosed = false
+                        //    ChannelPipedInputStream#closed = true
+                        //    ChannelPipedInputStream#writerClosed = false
                         // which leads to an IOException("Pipe closed") when reading.
                         IoUtils.closeQuietly(in, out, err);
                         IoUtils.closeQuietly(invertedIn, invertedOut, invertedErr);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java
index 35a2ff7..6b3047b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java
@@ -28,7 +28,7 @@ import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.buffer.Buffer;
 
 /**
- * Client channel to open a remot shell
+ * Client channel to open a remote shell
  *
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java
index 1034d52..2f9119b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java
@@ -106,7 +106,7 @@ public class ChannelSubsystem extends ChannelSession {
         String systemName = getSubsystem();
         Date pending = removePendingRequest(Channel.CHANNEL_SUBSYSTEM);
         if (pending != null) {
-            log.warn("handleFailure({}) susbsystem={}, pending since={}", this, systemName, pending);
+            log.warn("handleFailure({}) subsystem={}, pending since={}", this, systemName, pending);
             close(true);
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java
index f5fa825..2d41af7 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java
@@ -157,7 +157,7 @@ public class KnownHostHashValue {
 
         NamedFactory<Mac> factory =
                 ValidateUtils.checkNotNull(KnownHostDigest.fromName(components[1]),
-                        "Invalid hash pattern (unknwon digest): %s", pattern);
+                        "Invalid hash pattern (unknown digest): %s", pattern);
         value.setDigester(factory);
         value.setSaltValue(Base64.decodeString(components[2]));
         value.setDigestValue(Base64.decodeString(components[3]));

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
index 93fa5eb..eba487a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
@@ -76,7 +76,7 @@ public class KnownHostsServerKeyVerifier
     public static final String KNOWN_HOSTS_FILE_OPTION = "UserKnownHostsFile";
 
     /**
-     * Represents an entry in the internal verifier's cach
+     * Represents an entry in the internal verifier's cache
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     public static class HostEntryPair {
@@ -325,7 +325,7 @@ public class KnownHostsServerKeyVerifier
 
         if (matchLine.equals(newLine)) {
             if (log.isDebugEnabled()) {
-                log.debug("updateModifiedServerKey({})[{}] unmodified upodated lline for {}",
+                log.debug("updateModifiedServerKey({})[{}] unmodified updated line for {}",
                           clientSession, remoteAddress, matchLine);
             }
             return;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
index 9a1dc57..f798de5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
@@ -102,7 +102,7 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
         if (options.contains(Option.TargetIsDirectory)) {
             Boolean status = IoUtils.checkFileExists(local, opts);
             if (status == null) {
-                throw new SshException("Target directory " + local.toString() + " is probaly inaccesible");
+                throw new SshException("Target directory " + local.toString() + " is probably inaccesible");
             }
 
             if (!status) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionServiceFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionServiceFactory.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionServiceFactory.java
index d71ce1c..8373e22 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionServiceFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionServiceFactory.java
@@ -54,7 +54,7 @@ public class ClientConnectionServiceFactory extends AbstractConnectionServiceFac
 
     @Override
     public Service create(Session session) throws IOException {
-        ValidateUtils.checkTrue(session instanceof AbstractClientSession, "Not a client sesssion: %s", session);
+        ValidateUtils.checkTrue(session instanceof AbstractClientSession, "Not a client session: %s", session);
         ClientConnectionService service = new ClientConnectionService((AbstractClientSession) session);
         service.addPortForwardingEventListener(getPortForwardingEventListenerProxy());
         return service;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
index e0e52d2..aac8d57 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
@@ -84,7 +84,7 @@ public class ClientUserAuthService
             }
         } else {
             if (log.isDebugEnabled()) {
-                log.debug("ClientUserAuthService({}) use configured preferrences: {}", s, prefs);
+                log.debug("ClientUserAuthService({}) use configured preferences: {}", s, prefs);
             }
 
             for (String pref : GenericUtils.split(prefs, ',')) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpFileAttributeView.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpFileAttributeView.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpFileAttributeView.java
index 86b8ad5..140ac18 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpFileAttributeView.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpFileAttributeView.java
@@ -74,7 +74,7 @@ public abstract class AbstractSftpFileAttributeView extends AbstractLoggingBean
         try (SftpClient client = fs.getClient()) {
             try {
                 if (log.isDebugEnabled()) {
-                    log.debug("writeRemotAttributes({})[{}]: {}", fs, p, attrs);
+                    log.debug("writeRemoteAttributes({})[{}]: {}", fs, p, attrs);
                 }
                 client.setStat(p.toString(), attrs);
             } catch (SftpException e) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
index f61d302..dddcfd5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
@@ -340,7 +340,7 @@ public class DefaultSftpClient extends AbstractSftpClient {
                         remainingTimeout -= sleepMillis;
                     }
                 } catch (InterruptedException e) {
-                    throw (IOException) new InterruptedIOException("Interruppted init()").initCause(e);
+                    throw (IOException) new InterruptedIOException("Interrupted init()").initCause(e);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java
index 564d1d9..abf3a1d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java
@@ -53,7 +53,7 @@ public class SftpDirEntryIterator extends AbstractLoggingBean implements Iterato
     /**
      * @param client The {@link SftpClient} instance to use for the iteration
      * @param path The remote directory path
-     * @throws IOException If failed to gain access to the remote directory patj
+     * @throws IOException If failed to gain access to the remote directory path
      */
     public SftpDirEntryIterator(SftpClient client, String path) throws IOException {
         this(client, path, client.openDir(path), true);
@@ -72,7 +72,7 @@ public class SftpDirEntryIterator extends AbstractLoggingBean implements Iterato
      * @param path A hint as to the remote directory path - used only for logging
      * @param dirHandle The directory {@link Handle} to use for listing the entries
      * @param closeOnFinished If {@code true} then close the directory handle when
-     * all entries have been exahusted
+     * all entries have been exhausted
      */
     public SftpDirEntryIterator(SftpClient client, String path, Handle dirHandle, boolean closeOnFinished) {
         this.client = Objects.requireNonNull(client, "No SFTP client instance");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/SpaceAvailableExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/SpaceAvailableExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/SpaceAvailableExtension.java
index a7450e9..2cc938b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/SpaceAvailableExtension.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/SpaceAvailableExtension.java
@@ -24,7 +24,7 @@ import java.io.IOException;
 import org.apache.sshd.common.subsystem.sftp.extensions.SpaceAvailableExtensionInfo;
 
 /**
- * Implements the &quot;space-availble&quot; extension
+ * Implements the &quot;space-available&quot; extension
  *
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  * @see <A HREF="http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-09.txt">DRAFT 09 section 9.2</A>

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/common/Factory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/Factory.java b/sshd-core/src/main/java/org/apache/sshd/common/Factory.java
index 406eb5e..86f007d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/Factory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/Factory.java
@@ -20,7 +20,7 @@ package org.apache.sshd.common;
 
 
 /**
- * Fatory is a simple interface that is used to create other objects.
+ * Factory is a simple interface that is used to create other objects.
  *
  * @param <T> type of objets this factory will create
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java b/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java
index 919ba40..4ceb0c3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/SshConstants.java
@@ -139,7 +139,7 @@ public final class SshConstants {
      * @return {@code true} if this value is used by several <U>different</U> messages
      * @see #getAmbiguousOpcodes()
      */
-    public static boolean isAmbigouosOpcode(int cmd) {
+    public static boolean isAmbiguousOpcode(int cmd) {
         return getAmbiguousOpcodes().contains(cmd);
     }
 
@@ -162,7 +162,7 @@ public final class SshConstants {
                         }
 
                         try {
-                            return !isAmbigouosOpcode(f.getByte(null));
+                            return !isAmbiguousOpcode(f.getByte(null));
                         } catch (Exception e) {
                             return false;
                         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java b/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
index 35ba82a..27a42a2 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
@@ -358,7 +358,7 @@ public final class SshConfigFileReader {
      * @param v Checks if the value is &quot;yes&quot;, &quot;y&quot;
      *          or &quot;on&quot; or &quot;true&quot;.
      * @return The result - <B>Note:</B> {@code null}/empty values are
-     * intrepreted as {@code false}
+     * interpreted as {@code false}
      */
     public static boolean parseBooleanValue(String v) {
         return "yes".equalsIgnoreCase(v)

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/common/config/keys/DSSPublicKeyEntryDecoder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/DSSPublicKeyEntryDecoder.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/DSSPublicKeyEntryDecoder.java
index 424d0c6..6ea520e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/DSSPublicKeyEntryDecoder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/DSSPublicKeyEntryDecoder.java
@@ -52,7 +52,7 @@ public class DSSPublicKeyEntryDecoder extends AbstractPublicKeyEntryDecoder<DSAP
     @Override
     public DSAPublicKey decodePublicKey(String keyType, InputStream keyData) throws IOException, GeneralSecurityException {
         if (!KeyPairProvider.SSH_DSS.equals(keyType)) { // just in case we were invoked directly
-            throw new InvalidKeySpecException("Unepected key type: " + keyType);
+            throw new InvalidKeySpecException("Unexpected key type: " + keyType);
         }
 
         BigInteger p = decodeBigInt(keyData);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/common/config/keys/RSAPublicKeyDecoder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/RSAPublicKeyDecoder.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/RSAPublicKeyDecoder.java
index b9cabc9..94b5520 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/RSAPublicKeyDecoder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/RSAPublicKeyDecoder.java
@@ -52,7 +52,7 @@ public class RSAPublicKeyDecoder extends AbstractPublicKeyEntryDecoder<RSAPublic
     @Override
     public RSAPublicKey decodePublicKey(String keyType, InputStream keyData) throws IOException, GeneralSecurityException {
         if (!KeyPairProvider.SSH_RSA.equals(keyType)) { // just in case we were invoked directly
-            throw new InvalidKeySpecException("Unepected key type: " + keyType);
+            throw new InvalidKeySpecException("Unexpected key type: " + keyType);
         }
 
         BigInteger e = decodeBigInt(keyData);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java b/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
index 169daa1..367a12e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
@@ -156,7 +156,7 @@ public abstract class BaseFileSystem<T extends Path> extends FileSystem {
     }
 
     protected String globToRegex(String pattern) {
-        StringBuilder sb = new StringBuilder(ValidateUtils.checkNotNull(pattern, "No patern").length());
+        StringBuilder sb = new StringBuilder(ValidateUtils.checkNotNull(pattern, "No pattern").length());
         int inGroup = 0;
         int inClass = 0;
         int firstIndexInClass = -1;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java
index 523aa2c..2d8d1f1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java
@@ -51,7 +51,7 @@ public abstract class AbstractOpenSshHostKeysHandler extends AbstractConnectionS
 
     protected AbstractOpenSshHostKeysHandler(String request, BufferPublicKeyParser<? extends PublicKey> parser) {
         this.request = ValidateUtils.checkNotNullAndNotEmpty(request, "No request identifier");
-        this.parser = ValidateUtils.checkNotNull(parser, "No publick keys extractor");
+        this.parser = ValidateUtils.checkNotNull(parser, "No public keys extractor");
     }
 
     public final String getRequestName() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java
index 2e99576..3acae88 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java
@@ -50,7 +50,7 @@ public interface ScpTransferEventListener extends SshdEventListener {
     /**
      * @param op     The {@link FileOperation}
      * @param file   The <U>local</U> referenced file {@link Path}
-     * @param length Size (in bytes) of transfered data
+     * @param length Size (in bytes) of transferred data
      * @param perms  A {@link Set} of {@link PosixFilePermission}s to be applied
      *               once transfer is complete
      * @throws IOException If failed to handle the event
@@ -62,7 +62,7 @@ public interface ScpTransferEventListener extends SshdEventListener {
     /**
      * @param op     The {@link FileOperation}
      * @param file   The <U>local</U> referenced file {@link Path}
-     * @param length Size (in bytes) of transfered data
+     * @param length Size (in bytes) of transferred data
      * @param perms  A {@link Set} of {@link PosixFilePermission}s to be applied
      *               once transfer is complete
      * @param thrown The result of the operation attempt - if {@code null} then

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/common/util/EventNotifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/EventNotifier.java b/sshd-core/src/main/java/org/apache/sshd/common/util/EventNotifier.java
index 8e50cea..0cbcf30 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/EventNotifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/EventNotifier.java
@@ -20,7 +20,7 @@
 package org.apache.sshd.common.util;
 
 /**
- * Notify about the occurence of an event
+ * Notify about the occurrence of an event
  *
  * @param <E> type of event being notified
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
index b09f1f7..22383e7 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
@@ -547,7 +547,7 @@ public class ChannelSession extends AbstractServerChannel {
     protected RequestHandler.Result handleSubsystem(String request, Buffer buffer, boolean wantReply) throws IOException {
         String subsystem = buffer.getString();
         if (log.isDebugEnabled()) {
-            log.debug("handleSubsystem({})[want-reply={}] sybsystem={}",
+            log.debug("handleSubsystem({})[want-reply={}] subsystem={}",
                       this, wantReply, subsystem);
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java b/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java
index 3dd2d06..a8dd753 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java
@@ -56,7 +56,7 @@ public class TcpipForwardHandler extends AbstractConnectionServiceRequestHandler
         String address = buffer.getString();
         int port = buffer.getInt();
         SshdSocketAddress socketAddress = new SshdSocketAddress(address, port);
-        TcpipForwarder forwarder = ValidateUtils.checkNotNull(connectionService.getTcpipForwarder(), "No TCP/IP forwader");
+        TcpipForwarder forwarder = ValidateUtils.checkNotNull(connectionService.getTcpipForwarder(), "No TCP/IP forwarder");
         SshdSocketAddress bound = forwarder.localPortForwardingRequested(socketAddress);
         if (log.isDebugEnabled()) {
             log.debug("process({})[{}][want-reply-{}] {} => {}",

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java b/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
index 2ec01da..5026e1b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
@@ -268,7 +268,7 @@ public abstract class AbstractServerSession extends AbstractSession implements S
         for (String keyType : provided) {
             if (!supported.contains(keyType)) {
                 if (log.isDebugEnabled()) {
-                    log.debug("resolveAvailableSignaturesProposal({})[{}] {} not in suppored list: {}",
+                    log.debug("resolveAvailableSignaturesProposal({})[{}] {} not in supported list: {}",
                               this, provided, keyType, supported);
                 }
                 continue;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
index 22040fc..545ac57 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
@@ -232,7 +232,7 @@ public class ServerUserAuthService extends AbstractCloseable implements Service,
                               session, e.getClass().getSimpleName(), currentAuth.getName(), e.getMessage());
                 }
                 if (log.isTraceEnabled()) {
-                    log.trace("process(" + session + ") current authentiaction=" + currentAuth.getName() + " failure details", e);
+                    log.trace("process(" + session + ") current authentication=" + currentAuth.getName() + " failure details", e);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java
index f6f1e8e..e27fddd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java
@@ -200,7 +200,7 @@ public class FileHandle extends Handle {
         }
         if (lock == null) {
             throw new SftpException(SftpConstants.SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK,
-                    "No mtahcing lock found on range [" + offset + "-" + (offset + length));
+                    "No matching lock found on range [" + offset + "-" + (offset + length));
         }
 
         lock.release();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/main/java/org/apache/sshd/server/x11/DefaultX11ForwardSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/x11/DefaultX11ForwardSupport.java b/sshd-core/src/main/java/org/apache/sshd/server/x11/DefaultX11ForwardSupport.java
index 3e02e80..e96f4d1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/x11/DefaultX11ForwardSupport.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/x11/DefaultX11ForwardSupport.java
@@ -121,8 +121,8 @@ public class DefaultX11ForwardSupport extends AbstractInnerCloseable implements
                    + " failed to allocate internet-domain X11 display socket in range {}-{}",
                      authenticationProtocol, authenticationCookie, screen,
                      minDisplayNumber, maxDisplayNumber);
-            Collection<SocketAddress> boundAddressess = acceptor.getBoundAddresses();
-            if (GenericUtils.isEmpty(boundAddressess)) {
+            Collection<SocketAddress> boundAddresses = acceptor.getBoundAddresses();
+            if (GenericUtils.isEmpty(boundAddresses)) {
                 if (log.isDebugEnabled()) {
                     log.debug("createDisplay(auth={}, cookie={}, screen={}) closing - no more bound addresses",
                               authenticationProtocol, authenticationCookie, screen);
@@ -131,7 +131,7 @@ public class DefaultX11ForwardSupport extends AbstractInnerCloseable implements
             } else {
                 if (log.isDebugEnabled()) {
                     log.debug("createDisplay(auth={}, cookie={}, screen={}) closing - remaining bound addresses: {}",
-                              authenticationProtocol, authenticationCookie, screen, boundAddressess);
+                              authenticationProtocol, authenticationCookie, screen, boundAddresses);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/test/java/org/apache/sshd/common/SshConstantsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/SshConstantsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/SshConstantsTest.java
index 86eb6b4..40546ca 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/SshConstantsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/SshConstantsTest.java
@@ -60,13 +60,13 @@ public class SshConstantsTest extends BaseTestSupport {
 
         for (int cmd : knownAmbiguities) {
             assertEquals("Mismatched mnemonic for known ambiguity=" + cmd, Integer.toString(cmd), SshConstants.getCommandMessageName(cmd));
-            assertTrue("Known ambiguity not reported as such: " + cmd, SshConstants.isAmbigouosOpcode(cmd));
+            assertTrue("Known ambiguity not reported as such: " + cmd, SshConstants.isAmbiguousOpcode(cmd));
             assertTrue("Known ambiguity=" + cmd + " not listed: " + opcodes, opcodes.contains(cmd));
         }
 
         for (Integer cmd : opcodes) {
             assertEquals("Mismatched mnemonic for " + cmd, cmd.toString(), SshConstants.getCommandMessageName(cmd));
-            assertTrue("Opcode not detected as ambiguous: " + cmd, SshConstants.isAmbigouosOpcode(cmd));
+            assertTrue("Opcode not detected as ambiguous: " + cmd, SshConstants.isAmbiguousOpcode(cmd));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0fde8856/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java b/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java
index 9de3fc5..fa3c8ee 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java
@@ -64,7 +64,7 @@ public class KeyExchangeTest extends BaseTestSupport {
             String actual = xformer.transform(cmd);
             assertSame("Mismatched results for cmd=" + cmd, expected, actual);
 
-            if (SshConstants.isAmbigouosOpcode(cmd)) {
+            if (SshConstants.isAmbiguousOpcode(cmd)) {
                 assertEquals("Unexpected ambiguous command resolution for " + cmd, cmd.toString(), SshConstants.getCommandMessageName(cmd));
             }
         }


[11/16] mina-sshd git commit: [SSHD-698] Use lambda and method references, streams Deprecate Utils inner classes and use interface methods instead.

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
index 545ac57..e12adf7 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
@@ -34,6 +34,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
 
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.NamedFactory;
@@ -108,7 +109,7 @@ public class ServerUserAuthService extends AbstractCloseable implements Service,
         // Verify all required methods are supported
         for (List<String> l : authMethods) {
             for (String m : l) {
-                NamedFactory<UserAuth> factory = NamedResource.Utils.findByName(m, String.CASE_INSENSITIVE_ORDER, userAuthFactories);
+                NamedFactory<UserAuth> factory = NamedResource.findByName(m, String.CASE_INSENSITIVE_ORDER, userAuthFactories);
                 if (factory == null) {
                     throw new SshException("Configured method is not supported: " + m);
                 }
@@ -117,7 +118,7 @@ public class ServerUserAuthService extends AbstractCloseable implements Service,
 
         if (log.isDebugEnabled()) {
             log.debug("ServerUserAuthService({}) authorized authentication methods: {}",
-                      s, NamedResource.Utils.getNames(userAuthFactories));
+                      s, NamedResource.getNames(userAuthFactories));
         }
     }
 
@@ -188,7 +189,7 @@ public class ServerUserAuthService extends AbstractCloseable implements Service,
                           session, username, service, method, nbAuthRequests, maxAuthRequests);
             }
 
-            Factory<UserAuth> factory = NamedResource.Utils.findByName(method, String.CASE_INSENSITIVE_ORDER, userAuthFactories);
+            Factory<UserAuth> factory = NamedResource.findByName(method, String.CASE_INSENSITIVE_ORDER, userAuthFactories);
             if (factory != null) {
                 currentAuth = ValidateUtils.checkNotNull(factory.create(), "No authenticator created for method=%s", method);
                 try {
@@ -293,17 +294,11 @@ public class ServerUserAuthService extends AbstractCloseable implements Service,
             session.resetIdleTimeout();
             log.info("Session {}@{} authenticated", username, session.getIoSession().getRemoteAddress());
         } else {
-            StringBuilder sb = new StringBuilder();
-            for (List<String> l : authMethods) {
-                if (GenericUtils.size(l) > 0) {
-                    if (sb.length() > 0) {
-                        sb.append(",");
-                    }
-                    sb.append(l.get(0));
-                }
-            }
+            String remaining = authMethods.stream()
+                    .filter(GenericUtils::isNotEmpty)
+                    .map(l -> l.get(0))
+                    .collect(Collectors.joining(","));
 
-            String remaining = sb.toString();
             if (log.isDebugEnabled()) {
                 log.debug("handleAuthenticationSuccess({}@{}) remaining methods={}", username, session, remaining);
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
index 0cee65f..f810abd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
@@ -150,12 +150,7 @@ public class InvertedShellWrapper extends AbstractLoggingBean implements Command
         shellIn = shell.getInputStream();
         shellOut = shell.getOutputStream();
         shellErr = shell.getErrorStream();
-        executor.execute(new Runnable() {
-            @Override
-            public void run() {
-                pumpStreams();
-            }
-        });
+        executor.execute(this::pumpStreams);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
index 44b3caf..c10c5ec 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
@@ -21,6 +21,7 @@ package org.apache.sshd.server.shell;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.OsUtils;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/shell/TtyFilterOutputStream.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/TtyFilterOutputStream.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/TtyFilterOutputStream.java
index c9fede8..5ec2ae2 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/TtyFilterOutputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/TtyFilterOutputStream.java
@@ -66,11 +66,12 @@ public class TtyFilterOutputStream extends FilterOutputStream {
         }
     }
 
+    @SuppressWarnings("StatementWithEmptyBody")
     protected void handleCR() throws IOException {
         if (ttyOptions.contains(PtyMode.ICRNL)) {
             writeRawOutput('\n');   // Map CR to NL on input
         } else if (ttyOptions.contains(PtyMode.IGNCR)) {
-            return;    // Ignore CR on input
+            // Ignore CR on input
         } else {
             writeRawOutput('\r');
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/Handle.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/Handle.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/Handle.java
index 9253c4a..4b9547d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/Handle.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/Handle.java
@@ -46,6 +46,7 @@ public abstract class Handle implements java.nio.channels.Channel {
     @Override
     public void close() throws IOException {
         if (!closed.getAndSet(true)) {
+            //noinspection UnnecessaryReturnStatement
             return; // debug breakpoint
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
index 8144252..9377172 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
@@ -71,10 +71,13 @@ import java.util.TreeSet;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
 
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.NamedFactory;
+import org.apache.sshd.common.NamedResource;
 import org.apache.sshd.common.OptionalFeature;
 import org.apache.sshd.common.PropertyResolver;
 import org.apache.sshd.common.PropertyResolverUtils;
@@ -158,7 +161,9 @@ public class SftpSubsystem
 
     public static final int LOWER_SFTP_IMPL = SftpConstants.SFTP_V3; // Working implementation from v3
     public static final int HIGHER_SFTP_IMPL = SftpConstants.SFTP_V6; //  .. up to and including
-    public static final String ALL_SFTP_IMPL;
+    public static final String ALL_SFTP_IMPL = IntStream.rangeClosed(LOWER_SFTP_IMPL, HIGHER_SFTP_IMPL)
+                            .mapToObj(Integer::toString)
+                            .collect(Collectors.joining(","));
 
     /**
      * Force the use of a max. packet length - especially for {@link #doReadDir(Buffer, int)}
@@ -186,22 +191,16 @@ public class SftpSubsystem
     public static final Map<String, OptionalFeature> DEFAULT_SUPPORTED_CLIENT_EXTENSIONS =
             // TODO text-seek - see http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-13.txt
             // TODO home-directory - see http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-09.txt
-            Collections.unmodifiableMap(
-                    new LinkedHashMap<String, OptionalFeature>() {
-                        private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                        private final OptionalFeature anyDigests = OptionalFeature.Utils.any(BuiltinDigests.VALUES);
-                        {
-                            put(SftpConstants.EXT_VERSION_SELECT, OptionalFeature.TRUE);
-                            put(SftpConstants.EXT_COPY_FILE, OptionalFeature.TRUE);
-                            put(SftpConstants.EXT_MD5_HASH, BuiltinDigests.md5);
-                            put(SftpConstants.EXT_MD5_HASH_HANDLE, BuiltinDigests.md5);
-                            put(SftpConstants.EXT_CHECK_FILE_HANDLE, anyDigests);
-                            put(SftpConstants.EXT_CHECK_FILE_NAME, anyDigests);
-                            put(SftpConstants.EXT_COPY_DATA, OptionalFeature.TRUE);
-                            put(SftpConstants.EXT_SPACE_AVAILABLE, OptionalFeature.TRUE);
-                        }
-                    });
+            GenericUtils.<String, OptionalFeature>mapBuilder()
+                .put(SftpConstants.EXT_VERSION_SELECT, OptionalFeature.TRUE)
+                .put(SftpConstants.EXT_COPY_FILE, OptionalFeature.TRUE)
+                .put(SftpConstants.EXT_MD5_HASH, BuiltinDigests.md5)
+                .put(SftpConstants.EXT_MD5_HASH_HANDLE, BuiltinDigests.md5)
+                .put(SftpConstants.EXT_CHECK_FILE_HANDLE, OptionalFeature.any(BuiltinDigests.VALUES))
+                .put(SftpConstants.EXT_CHECK_FILE_NAME, OptionalFeature.any(BuiltinDigests.VALUES))
+                .put(SftpConstants.EXT_COPY_DATA, OptionalFeature.TRUE)
+                .put(SftpConstants.EXT_SPACE_AVAILABLE, OptionalFeature.TRUE)
+                .immutable();
 
     /**
      * Comma-separated list of which {@code OpenSSH} extensions are reported and
@@ -218,16 +217,7 @@ public class SftpSubsystem
                     ));
 
     public static final List<String> DEFAULT_OPEN_SSH_EXTENSIONS_NAMES =
-            Collections.unmodifiableList(new ArrayList<String>(DEFAULT_OPEN_SSH_EXTENSIONS.size()) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    for (OpenSSHExtension ext : DEFAULT_OPEN_SSH_EXTENSIONS) {
-                        add(ext.getName());
-                    }
-                }
-
-            });
+            Collections.unmodifiableList(NamedResource.getNameList(DEFAULT_OPEN_SSH_EXTENSIONS));
 
     public static final List<String> DEFAULT_UNIX_VIEW = Collections.singletonList("unix:*");
 
@@ -256,29 +246,14 @@ public class SftpSubsystem
      * effort if not accessible via the file system attributes views
      */
     public static final Map<String, FileInfoExtractor<?>> FILEATTRS_RESOLVERS =
-            Collections.unmodifiableMap(new TreeMap<String, FileInfoExtractor<?>>(String.CASE_INSENSITIVE_ORDER) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    put("isRegularFile", FileInfoExtractor.ISREG);
-                    put("isDirectory", FileInfoExtractor.ISDIR);
-                    put("isSymbolicLink", FileInfoExtractor.ISSYMLINK);
-                    put("permissions", FileInfoExtractor.PERMISSIONS);
-                    put("size", FileInfoExtractor.SIZE);
-                    put("lastModifiedTime", FileInfoExtractor.LASTMODIFIED);
-                }
-            });
-
-    static {
-        StringBuilder sb = new StringBuilder(2 * (1 + (HIGHER_SFTP_IMPL - LOWER_SFTP_IMPL)));
-        for (int v = LOWER_SFTP_IMPL; v <= HIGHER_SFTP_IMPL; v++) {
-            if (sb.length() > 0) {
-                sb.append(',');
-            }
-            sb.append(v);
-        }
-        ALL_SFTP_IMPL = sb.toString();
-    }
+            GenericUtils.<String, FileInfoExtractor<?>>mapBuilder(String.CASE_INSENSITIVE_ORDER)
+                .put("isRegularFile", FileInfoExtractor.ISREG)
+                .put("isDirectory", FileInfoExtractor.ISDIR)
+                .put("isSymbolicLink", FileInfoExtractor.ISSYMLINK)
+                .put("permissions", FileInfoExtractor.PERMISSIONS)
+                .put("size", FileInfoExtractor.SIZE)
+                .put("lastModifiedTime", FileInfoExtractor.LASTMODIFIED)
+                .immutable();
 
     protected ExitCallback callback;
     protected InputStream in;
@@ -2851,21 +2826,18 @@ public class SftpSubsystem
         } else if (supportedViews.contains("unix")) {
             views = DEFAULT_UNIX_VIEW;
         } else {
-            views = new ArrayList<>(supportedViews.size());
-            for (String v : supportedViews) {
-                views.add(v + ":*");
-            }
+            views = GenericUtils.map(supportedViews, v -> v + ":*");
         }
 
         for (String v : views) {
             Map<String, Object> ta = readFileAttributes(file, v, options);
-            if (GenericUtils.size(ta) > 0) {
+            if (GenericUtils.isNotEmpty(ta)) {
                 attrs.putAll(ta);
             }
         }
 
         Map<String, Object> completions = resolveMissingFileAttributes(file, flags, attrs, options);
-        if (GenericUtils.size(completions) > 0) {
+        if (GenericUtils.isNotEmpty(completions)) {
             attrs.putAll(completions);
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java
index bdc5d2e..3fe2721 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java
@@ -19,7 +19,6 @@
 
 package org.apache.sshd.server.subsystem.sftp;
 
-import java.util.Collection;
 import java.util.concurrent.ExecutorService;
 
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
@@ -67,14 +66,7 @@ public class SftpSubsystemFactory extends AbstractSftpEventListenerManager imple
             factory.setExecutorService(executors);
             factory.setShutdownOnExit(shutdownExecutor);
             factory.setUnsupportedAttributePolicy(policy);
-
-            Collection<? extends SftpEventListener> listeners = getRegisteredListeners();
-            if (GenericUtils.size(listeners) > 0) {
-                for (SftpEventListener l : listeners) {
-                    factory.addSftpEventListener(l);
-                }
-            }
-
+            GenericUtils.forEach(getRegisteredListeners(), factory::addSftpEventListener);
             return factory;
         }
     }
@@ -136,13 +128,7 @@ public class SftpSubsystemFactory extends AbstractSftpEventListenerManager imple
     @Override
     public Command create() {
         SftpSubsystem subsystem = new SftpSubsystem(getExecutorService(), isShutdownOnExit(), getUnsupportedAttributePolicy());
-        Collection<? extends SftpEventListener> listeners = getRegisteredListeners();
-        if (GenericUtils.size(listeners) > 0) {
-            for (SftpEventListener l : listeners) {
-                subsystem.addSftpEventListener(l);
-            }
-        }
-
+        GenericUtils.forEach(getRegisteredListeners(), subsystem::addSftpEventListener);
         return subsystem;
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java b/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
index 4cffe5e..3ebff89 100644
--- a/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
@@ -23,8 +23,6 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -160,17 +158,14 @@ public class KeyReExchangeTest extends BaseTestSupport {
                     @Override
                     public KeyExchange create() {
                         final KeyExchange proxiedInstance = factory.create();
-                        return (KeyExchange) Proxy.newProxyInstance(loader, interfaces, new InvocationHandler() {
-                            @Override
-                            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-                                String name = method.getName();
-                                if ("init".equals(name) && (!successfulInit.get())) {
-                                    throw new UnsupportedOperationException("Intentionally failing 'init'");
-                                } else if ("next".equals(name) && (!successfulNext.get())) {
-                                    throw new UnsupportedOperationException("Intentionally failing 'next'");
-                                } else {
-                                    return method.invoke(proxiedInstance, args);
-                                }
+                        return (KeyExchange) Proxy.newProxyInstance(loader, interfaces, (proxy, method, args) -> {
+                            String name = method.getName();
+                            if ("init".equals(name) && (!successfulInit.get())) {
+                                throw new UnsupportedOperationException("Intentionally failing 'init'");
+                            } else if ("next".equals(name) && (!successfulNext.get())) {
+                                throw new UnsupportedOperationException("Intentionally failing 'next'");
+                            } else {
+                                return method.invoke(proxiedInstance, args);
                             }
                         });
                     }
@@ -485,12 +480,6 @@ public class KeyReExchangeTest extends BaseTestSupport {
                     teeOut.write("this is my command\n".getBytes(StandardCharsets.UTF_8));
                     teeOut.flush();
 
-                    StringBuilder sb = new StringBuilder(101 * 10);
-                    for (int i = 0; i < 100; i++) {
-                        sb.append("0123456789");
-                    }
-                    sb.append('\n');
-
                     final AtomicInteger exchanges = new AtomicInteger();
                     session.addSessionListener(new SessionListener() {
                         @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/LoadTest.java b/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
index 2e5566f..4d9b796 100644
--- a/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
@@ -22,8 +22,8 @@ import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -96,18 +96,15 @@ public class LoadTest extends BaseTestSupport {
         final List<Throwable> errors = new ArrayList<>();
         final CountDownLatch latch = new CountDownLatch(nbThreads);
         for (int i = 0; i < nbThreads; i++) {
-            Runnable r = new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        for (int i = 0; i < nbSessionsPerThread; i++) {
-                            runClient(msg);
-                        }
-                    } catch (Throwable t) {
-                        errors.add(t);
-                    } finally {
-                        latch.countDown();
+            Runnable r = () -> {
+                try {
+                    for (int i1 = 0; i1 < nbSessionsPerThread; i1++) {
+                        runClient(msg);
                     }
+                } catch (Throwable t) {
+                    errors.add(t);
+                } finally {
+                    latch.countDown();
                 }
             };
             new Thread(r).start();
@@ -123,9 +120,8 @@ public class LoadTest extends BaseTestSupport {
         try (SshClient client = setupTestClient()) {
             PropertyResolverUtils.updateProperty(client, FactoryManager.MAX_PACKET_SIZE, 1024 * 16);
             PropertyResolverUtils.updateProperty(client, FactoryManager.WINDOW_SIZE, 1024 * 8);
-            client.setKeyExchangeFactories(Arrays.asList(
-                    ClientBuilder.DH2KEX.transform(BuiltinDHFactories.dhg1)));
-            client.setCipherFactories(Arrays.asList(BuiltinCiphers.blowfishcbc));
+            client.setKeyExchangeFactories(Collections.singletonList(ClientBuilder.DH2KEX.transform(BuiltinDHFactories.dhg1)));
+            client.setCipherFactories(Collections.singletonList(BuiltinCiphers.blowfishcbc));
             client.start();
             try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
                 session.addPasswordIdentity(getCurrentTestName());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/WindowAdjustTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/WindowAdjustTest.java b/sshd-core/src/test/java/org/apache/sshd/WindowAdjustTest.java
index 61d0345..a4fe2ae 100644
--- a/sshd-core/src/test/java/org/apache/sshd/WindowAdjustTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/WindowAdjustTest.java
@@ -37,11 +37,8 @@ import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.channel.ClientChannel;
 import org.apache.sshd.client.channel.ClientChannelEvent;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.common.Factory;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.io.IoInputStream;
 import org.apache.sshd.common.io.IoOutputStream;
-import org.apache.sshd.common.io.IoWriteFuture;
 import org.apache.sshd.common.io.WritePendingException;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
@@ -49,7 +46,6 @@ import org.apache.sshd.common.util.io.NoCloseOutputStream;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.server.AsyncCommand;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.Environment;
 import org.apache.sshd.server.ExitCallback;
 import org.apache.sshd.server.SshServer;
@@ -90,12 +86,7 @@ public class WindowAdjustTest extends BaseTestSupport {
 
         final byte[] msg = Files.readAllBytes(
                 Paths.get(getClass().getResource("/big-msg.txt").toURI()));
-        sshServer.setShellFactory(new Factory<Command>() {
-            @Override
-            public Command create() {
-                return new FloodingAsyncCommand(msg, BIG_MSG_SEND_COUNT, END_FILE);
-            }
-        });
+        sshServer.setShellFactory(() -> new FloodingAsyncCommand(msg, BIG_MSG_SEND_COUNT, END_FILE));
 
         sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
         sshServer.start();
@@ -182,7 +173,7 @@ public class WindowAdjustTest extends BaseTestSupport {
         private static final AtomicInteger POOL_COUNT = new AtomicInteger(0);
 
         private final AtomicReference<ExecutorService> executorHolder = new AtomicReference<>();
-        private final AtomicReference<Future<?>> futureHolder = new AtomicReference<Future<?>>();
+        private final AtomicReference<Future<?>> futureHolder = new AtomicReference<>();
 
         private AsyncInPendingWrapper pendingWrapper;
         private byte[] msg;
@@ -237,17 +228,13 @@ public class WindowAdjustTest extends BaseTestSupport {
             ExecutorService service = ThreadUtils.newSingleThreadExecutor(getClass().getSimpleName() + "-" + POOL_COUNT.incrementAndGet());
             executorHolder.set(service);
 
-            futureHolder.set(service.submit(new Runnable() {
-                @SuppressWarnings("synthetic-access")
-                @Override
-                public void run() {
-                    log.info("Start heavy load sending " + sendCount + " messages of " + msg.length + " bytes");
-                    for (int i = 0; i < sendCount; i++) {
-                        pendingWrapper.write(new ByteArrayBuffer(msg));
-                    }
-                    log.info("Sending EOF signal");
-                    pendingWrapper.write(new ByteArrayBuffer(new byte[]{eofSignal}));
+            futureHolder.set(service.submit((Runnable) () -> {
+                log.info("Start heavy load sending " + sendCount + " messages of " + msg.length + " bytes");
+                for (int i = 0; i < sendCount; i++) {
+                    pendingWrapper.write(new ByteArrayBuffer(msg));
                 }
+                log.info("Sending EOF signal");
+                pendingWrapper.write(new ByteArrayBuffer(new byte[]{eofSignal}));
             }));
             log.info("Started");
         }
@@ -277,15 +264,7 @@ public class WindowAdjustTest extends BaseTestSupport {
         private IoOutputStream asyncIn;
 
         // Order has to be preserved for queued writes
-        private final Deque<Buffer> pending = new LinkedList<Buffer>() {
-            // we don't expect to serialize it
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public boolean add(Buffer o) {
-                return super.add(o);
-            }
-        };
+        private final Deque<Buffer> pending = new LinkedList<Buffer>();
 
         AsyncInPendingWrapper(IoOutputStream out) {
             this.asyncIn = out;
@@ -305,19 +284,15 @@ public class WindowAdjustTest extends BaseTestSupport {
 
         private void writeWithPendingDetection(final Buffer msg, final boolean wasPending) {
             try {
-                asyncIn.write(msg).addListener(new SshFutureListener<IoWriteFuture>() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public void operationComplete(IoWriteFuture future) {
-                        if (future.isWritten()) {
-                            if (wasPending) {
-                                pending.remove();
-                            }
-                            writePendingIfAny();
-                        } else {
-                            Throwable t = future.getException();
-                            log.warn("Failed to write message", t);
+                asyncIn.write(msg).addListener(future -> {
+                    if (future.isWritten()) {
+                        if (wasPending) {
+                            pending.remove();
                         }
+                        writePendingIfAny();
+                    } else {
+                        Throwable t = future.getException();
+                        log.warn("Failed to write message", t);
                     }
                 });
             } catch (final WritePendingException e) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java b/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
index a7e18fe..d0cc821 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
@@ -147,7 +147,7 @@ public class ClientAuthenticationManagerTest extends BaseTestSupport {
         };
         assertEquals("Mismatched initial factories list", "", manager.getUserAuthFactoriesNameList());
 
-        String expected = NamedResource.Utils.getNames(BuiltinUserAuthFactories.VALUES);
+        String expected = NamedResource.getNames(BuiltinUserAuthFactories.VALUES);
         manager.setUserAuthFactoriesNameList(expected);
         assertEquals("Mismatched updated factories names", expected, manager.getUserAuthFactoriesNameList());
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java b/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java
index 291099d..dead8c2 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java
@@ -20,8 +20,6 @@
 package org.apache.sshd.client;
 
 import java.io.IOException;
-import java.net.SocketAddress;
-import java.security.PublicKey;
 import java.util.Collections;
 import java.util.EnumMap;
 import java.util.List;
@@ -125,12 +123,9 @@ public class ClientSessionListenerTest extends BaseTestSupport {
     @Test
     public void testSessionListenerCanInfluenceAuthentication() throws IOException {
         final AtomicInteger verificationCount = new AtomicInteger();
-        final ServerKeyVerifier verifier = new ServerKeyVerifier() {
-            @Override
-            public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
-                verificationCount.incrementAndGet();
-                return true;
-            }
+        final ServerKeyVerifier verifier = (sshClientSession, remoteAddress, serverKey) -> {
+            verificationCount.incrementAndGet();
+            return true;
         };
 
         SessionListener listener = new SessionListener() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
index aaab336..d939b11 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
@@ -27,10 +27,8 @@ import java.io.OutputStream;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
 import java.net.InetSocketAddress;
-import java.net.SocketAddress;
 import java.nio.charset.StandardCharsets;
 import java.security.KeyPair;
-import java.security.PublicKey;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -60,7 +58,6 @@ import org.apache.sshd.client.channel.ClientChannel;
 import org.apache.sshd.client.channel.ClientChannelEvent;
 import org.apache.sshd.client.future.AuthFuture;
 import org.apache.sshd.client.future.OpenFuture;
-import org.apache.sshd.client.keyverifier.ServerKeyVerifier;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.client.subsystem.SubsystemClient;
 import org.apache.sshd.client.subsystem.sftp.SftpClient;
@@ -102,7 +99,6 @@ import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.auth.keyboard.DefaultKeyboardInteractiveAuthenticator;
 import org.apache.sshd.server.auth.keyboard.KeyboardInteractiveAuthenticator;
 import org.apache.sshd.server.auth.password.RejectAllPasswordAuthenticator;
-import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
 import org.apache.sshd.server.channel.ChannelSession;
 import org.apache.sshd.server.channel.ChannelSessionFactory;
 import org.apache.sshd.server.forward.DirectTcpipFactory;
@@ -446,34 +442,25 @@ public class ClientTest extends BaseTestSupport {
         client.start();
 
         try (final ClientSession session = createTestClientSession()) {
-            testClientListener(channelHolder, ChannelShell.class, new Factory<ChannelShell>() {
-                @Override
-                public ChannelShell create() {
-                    try {
-                        return session.createShellChannel();
-                    } catch (IOException e) {
-                        throw new RuntimeException(e);
-                    }
+            testClientListener(channelHolder, ChannelShell.class, () -> {
+                try {
+                    return session.createShellChannel();
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
                 }
             });
-            testClientListener(channelHolder, ChannelExec.class, new Factory<ChannelExec>() {
-                @Override
-                public ChannelExec create() {
-                    try {
-                        return session.createExecChannel(getCurrentTestName());
-                    } catch (IOException e) {
-                        throw new RuntimeException(e);
-                    }
+            testClientListener(channelHolder, ChannelExec.class, () -> {
+                try {
+                    return session.createExecChannel(getCurrentTestName());
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
                 }
             });
-            testClientListener(channelHolder, SftpClient.class, new Factory<SftpClient>() {
-                @Override
-                public SftpClient create() {
-                    try {
-                        return session.createSftpClient();
-                    } catch (IOException e) {
-                        throw new RuntimeException(e);
-                    }
+            testClientListener(channelHolder, SftpClient.class, () -> {
+                try {
+                    return session.createSftpClient();
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
                 }
             });
         } finally {
@@ -955,7 +942,7 @@ public class ClientTest extends BaseTestSupport {
     public void testPublicKeyAuth() throws Exception {
         sshd.setPasswordAuthenticator(RejectAllPasswordAuthenticator.INSTANCE);
         sshd.setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator.NONE);
-        client.setUserAuthFactories(Arrays.asList(UserAuthPublicKeyFactory.INSTANCE));
+        client.setUserAuthFactories(Collections.singletonList(UserAuthPublicKeyFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -974,13 +961,8 @@ public class ClientTest extends BaseTestSupport {
         provider.setAlgorithm(KeyUtils.RSA_ALGORITHM);
 
         final KeyPair pair = createTestHostKeyProvider().loadKey(KeyPairProvider.SSH_RSA);
-        sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
-            @Override
-            public boolean authenticate(String username, PublicKey key, ServerSession session) {
-                return key.equals(pair.getPublic());
-            }
-        });
-        client.setUserAuthFactories(Arrays.asList(UserAuthPublicKeyFactory.INSTANCE));
+        sshd.setPublickeyAuthenticator((username, key, session) -> key.equals(pair.getPublic()));
+        client.setUserAuthFactories(Collections.singletonList(UserAuthPublicKeyFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -996,7 +978,7 @@ public class ClientTest extends BaseTestSupport {
 
     @Test
     public void testPasswordAuthNew() throws Exception {
-        client.setUserAuthFactories(Arrays.asList(UserAuthPasswordFactory.INSTANCE));
+        client.setUserAuthFactories(Collections.singletonList(UserAuthPasswordFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = createTestClientSession()) {
@@ -1009,7 +991,7 @@ public class ClientTest extends BaseTestSupport {
 
     @Test
     public void testPasswordAuthNewWithFailureOnFirstIdentity() throws Exception {
-        client.setUserAuthFactories(Arrays.asList(UserAuthPasswordFactory.INSTANCE));
+        client.setUserAuthFactories(Collections.singletonList(UserAuthPasswordFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1025,7 +1007,7 @@ public class ClientTest extends BaseTestSupport {
 
     @Test
     public void testKeyboardInteractiveAuthNew() throws Exception {
-        client.setUserAuthFactories(Arrays.asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+        client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = createTestClientSession()) {
@@ -1038,7 +1020,7 @@ public class ClientTest extends BaseTestSupport {
 
     @Test
     public void testKeyboardInteractiveAuthNewWithFailureOnFirstIdentity() throws Exception {
-        client.setUserAuthFactories(Arrays.asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+        client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1055,7 +1037,7 @@ public class ClientTest extends BaseTestSupport {
     @Test   // see SSHD-504
     public void testDefaultKeyboardInteractivePasswordPromptLocationIndependence() throws Exception {
         final Collection<String> mismatchedPrompts = new LinkedList<>();
-        client.setUserAuthFactories(Arrays.asList(new UserAuthKeyboardInteractiveFactory() {
+        client.setUserAuthFactories(Collections.singletonList(new UserAuthKeyboardInteractiveFactory() {
             @Override
             public UserAuthKeyboardInteractive create() {
                 return new UserAuthKeyboardInteractive() {
@@ -1074,38 +1056,20 @@ public class ClientTest extends BaseTestSupport {
         }));
         client.start();
 
-        final Transformer<String, String> stripper = new Transformer<String, String>() {
-            @Override
-            public String transform(String input) {
-                int pos = GenericUtils.isEmpty(input) ? -1 : input.lastIndexOf(':');
-                if (pos < 0) {
-                    return input;
-                } else {
-                    return input.substring(0, pos);
-                }
+        final Transformer<String, String> stripper = input -> {
+            int pos = GenericUtils.isEmpty(input) ? -1 : input.lastIndexOf(':');
+            if (pos < 0) {
+                return input;
+            } else {
+                return input.substring(0, pos);
             }
         };
         final List<Transformer<String, String>> xformers =
-                Collections.unmodifiableList(Arrays.asList(
-                        new Transformer<String, String>() {  // prefixed
-                            @Override
-                            public String transform(String input) {
-                                return getCurrentTestName() + " " + input;
-                            }
-                        },
-                        new Transformer<String, String>() {  // suffixed
-                            @Override
-                            public String transform(String input) {
-                                return stripper.transform(input) + " " + getCurrentTestName() + ":";
-                            }
-                        },
-                        new Transformer<String, String>() {  // infix
-                            @Override
-                            public String transform(String input) {
-                                return getCurrentTestName() + " " + stripper.transform(input) + " " + getCurrentTestName() + ":";
-                            }
-                        }
-                ));
+            Collections.unmodifiableList(Arrays.<Transformer<String, String>>asList(
+                input -> getCurrentTestName() + " " + input,
+                input -> stripper.transform(input) + " " + getCurrentTestName() + ":",
+                input -> getCurrentTestName() + " " + stripper.transform(input) + " " + getCurrentTestName() + ":"
+            ));
         sshd.setKeyboardInteractiveAuthenticator(new DefaultKeyboardInteractiveAuthenticator() {
             private int xformerIndex;
 
@@ -1356,14 +1320,11 @@ public class ClientTest extends BaseTestSupport {
     public void testWaitAuth() throws Exception {
         final AtomicBoolean ok = new AtomicBoolean();
         client.setServerKeyVerifier(
-                new ServerKeyVerifier() {
-                    @Override
-                    public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
-                        outputDebugMessage("verifyServerKey(%s): %s", remoteAddress, serverKey);
-                        ok.set(true);
-                        return true;
-                    }
-                }
+            (sshClientSession, remoteAddress, serverKey) -> {
+                outputDebugMessage("verifyServerKey(%s): %s", remoteAddress, serverKey);
+                ok.set(true);
+                return true;
+            }
         );
         client.start();
 
@@ -1394,7 +1355,7 @@ public class ClientTest extends BaseTestSupport {
             Set<Integer> ids = new HashSet<>(channels.size());
             for (ClientChannel c : channels) {
                 int id = c.getId();
-                assertTrue("Channel ID repeated: " + id, ids.add(Integer.valueOf(id)));
+                assertTrue("Channel ID repeated: " + id, ids.add(id));
             }
         } finally {
             for (Closeable c : channels) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/auth/PasswordIdentityProviderTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/auth/PasswordIdentityProviderTest.java b/sshd-core/src/test/java/org/apache/sshd/client/auth/PasswordIdentityProviderTest.java
index bdda762..5078bae 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/auth/PasswordIdentityProviderTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/auth/PasswordIdentityProviderTest.java
@@ -54,12 +54,12 @@ public class PasswordIdentityProviderTest extends BaseTestSupport {
             Collection<String> passwords = Arrays.asList(va);
             expected.addAll(passwords);
 
-            PasswordIdentityProvider p = PasswordIdentityProvider.Utils.wrap(passwords);
+            PasswordIdentityProvider p = PasswordIdentityProvider.wrap(passwords);
             assertProviderContents("Wrapped", p, passwords);
             providers.add(p);
         }
 
-        PasswordIdentityProvider p = PasswordIdentityProvider.Utils.multiProvider(providers);
+        PasswordIdentityProvider p = PasswordIdentityProvider.multiProvider(providers);
         assertProviderContents("Multi", p, expected);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/channel/ChannelExecTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/channel/ChannelExecTest.java b/sshd-core/src/test/java/org/apache/sshd/client/channel/ChannelExecTest.java
index 2f4c10c..01cfed4 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/channel/ChannelExecTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/channel/ChannelExecTest.java
@@ -25,8 +25,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.server.Command;
-import org.apache.sshd.server.CommandFactory;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.CommandExecutionHelper;
@@ -53,18 +51,13 @@ public class ChannelExecTest extends BaseTestSupport {
     @BeforeClass
     public static void setupClientAndServer() throws Exception {
         sshd = Utils.setupTestServer(ChannelExecTest.class);
-        sshd.setCommandFactory(new CommandFactory() {
+        sshd.setCommandFactory(command -> new CommandExecutionHelper(command) {
             @Override
-            public Command createCommand(String command) {
-                return new CommandExecutionHelper(command) {
-                    @Override
-                    protected boolean handleCommandLine(String command) throws Exception {
-                        OutputStream stdout = getOut();
-                        stdout.write(command.getBytes(StandardCharsets.US_ASCII));
-                        stdout.flush();
-                        return false;
-                    }
-                };
+            protected boolean handleCommandLine(String command) throws Exception {
+                OutputStream stdout = getOut();
+                stdout.write(command.getBytes(StandardCharsets.US_ASCII));
+                stdout.flush();
+                return false;
             }
         });
         sshd.start();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryResolverTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryResolverTest.java b/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryResolverTest.java
index ccb874f..9871ed5 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryResolverTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryResolverTest.java
@@ -26,7 +26,6 @@ import java.net.SocketAddress;
 import java.nio.file.Path;
 import java.security.GeneralSecurityException;
 import java.security.KeyPair;
-import java.security.PublicKey;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -48,8 +47,6 @@ import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.net.SshdSocketAddress;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.auth.password.RejectAllPasswordAuthenticator;
-import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
-import org.apache.sshd.server.session.ServerSession;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.Utils;
 import org.junit.After;
@@ -93,12 +90,7 @@ public class HostConfigEntryResolverTest extends BaseTestSupport {
     @Test
     public void testEffectiveHostConfigResolution() throws Exception {
         final HostConfigEntry entry = new HostConfigEntry(getCurrentTestName(), TEST_LOCALHOST, port, getCurrentTestName());
-        client.setHostConfigEntryResolver(new HostConfigEntryResolver() {
-            @Override
-            public HostConfigEntry resolveEffectiveHost(String host, int portValue, String username) throws IOException {
-                return entry;
-            }
-        });
+        client.setHostConfigEntryResolver((host, portValue, username) -> entry);
         client.start();
 
         try (ClientSession session = client.connect(
@@ -143,15 +135,12 @@ public class HostConfigEntryResolverTest extends BaseTestSupport {
         final KeyPair identity = Utils.getFirstKeyPair(sshd);
         final String user = getCurrentTestName();
         // make sure authentication is achieved only via the identity public key
-        sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
-            @Override
-            public boolean authenticate(String username, PublicKey key, ServerSession session) {
-                if (user.equals(username)) {
-                    return KeyUtils.compareKeys(identity.getPublic(), key);
-                }
-
-                return false;
+        sshd.setPublickeyAuthenticator((username, key, session) -> {
+            if (user.equals(username)) {
+                return KeyUtils.compareKeys(identity.getPublic(), key);
             }
+
+            return false;
         });
         sshd.setPasswordAuthenticator(RejectAllPasswordAuthenticator.INSTANCE);
 
@@ -177,12 +166,7 @@ public class HostConfigEntryResolverTest extends BaseTestSupport {
         final String host = getClass().getSimpleName();
         final HostConfigEntry entry = new HostConfigEntry(host, TEST_LOCALHOST, port, user);
         entry.addIdentity(clientIdentity);
-        client.setHostConfigEntryResolver(new HostConfigEntryResolver() {
-            @Override
-            public HostConfigEntry resolveEffectiveHost(String host, int portValue, String username) throws IOException {
-                return entry;
-            }
-        });
+        client.setHostConfigEntryResolver((host1, portValue, username) -> entry);
 
         client.start();
         try (ClientSession session = client.connect(
@@ -209,19 +193,16 @@ public class HostConfigEntryResolverTest extends BaseTestSupport {
         final String user = getCurrentTestName();
         final AtomicBoolean defaultClientIdentityAttempted = new AtomicBoolean(false);
         // make sure authentication is achieved only via the identity public key
-        sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
-            @Override
-            public boolean authenticate(String username, PublicKey key, ServerSession session) {
-                if (KeyUtils.compareKeys(defaultIdentity.getPublic(), key)) {
-                    defaultClientIdentityAttempted.set(true);
-                }
-
-                if (user.equals(username)) {
-                    return KeyUtils.compareKeys(specificIdentity.getPublic(), key);
-                }
+        sshd.setPublickeyAuthenticator((username, key, session) -> {
+            if (KeyUtils.compareKeys(defaultIdentity.getPublic(), key)) {
+                defaultClientIdentityAttempted.set(true);
+            }
 
-                return false;
+            if (user.equals(username)) {
+                return KeyUtils.compareKeys(specificIdentity.getPublic(), key);
             }
+
+            return false;
         });
         sshd.setPasswordAuthenticator(RejectAllPasswordAuthenticator.INSTANCE);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/config/keys/ClientIdentityTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/config/keys/ClientIdentityTest.java b/sshd-core/src/test/java/org/apache/sshd/client/config/keys/ClientIdentityTest.java
index e392e86..4618a8c 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/config/keys/ClientIdentityTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/config/keys/ClientIdentityTest.java
@@ -79,7 +79,7 @@ public class ClientIdentityTest extends BaseTestSupport {
                 options);
         assertEquals("Mismatched loaded ids count", GenericUtils.size(expected), GenericUtils.size(ids));
 
-        Collection<KeyPair> pairs = new ArrayList<KeyPair>(ids.size());
+        Collection<KeyPair> pairs = new ArrayList<>(ids.size());
         for (BuiltinIdentities type : BuiltinIdentities.VALUES) {
             if (expected.contains(type)) {
                 KeyPair kp = ids.get(type.getName());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifierTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifierTest.java b/sshd-core/src/test/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifierTest.java
index e7f028e..c8666b1 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifierTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifierTest.java
@@ -63,7 +63,7 @@ import org.mockito.Mockito;
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class KnownHostsServerKeyVerifierTest extends BaseTestSupport {
     private static final String HASHED_HOST = "192.168.1.61";
-    private static final Map<String, PublicKey> HOST_KEYS = new TreeMap<String, PublicKey>(String.CASE_INSENSITIVE_ORDER);
+    private static final Map<String, PublicKey> HOST_KEYS = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
     private static Map<String, KnownHostEntry> hostsEntries;
     private static Path entriesFile;
 
@@ -91,13 +91,10 @@ public class KnownHostsServerKeyVerifierTest extends BaseTestSupport {
     @Test
     public void testNoUpdatesNoNewHostsAuthentication() throws Exception {
         final AtomicInteger delegateCount = new AtomicInteger(0);
-        ServerKeyVerifier delegate = new ServerKeyVerifier() {
-            @Override
-            public boolean verifyServerKey(ClientSession clientSession, SocketAddress remoteAddress, PublicKey serverKey) {
-                delegateCount.incrementAndGet();
-                fail("verifyServerKey(" + clientSession + ")[" + remoteAddress + "] unexpected invocation");
-                return false;
-            }
+        ServerKeyVerifier delegate = (clientSession, remoteAddress, serverKey) -> {
+            delegateCount.incrementAndGet();
+            fail("verifyServerKey(" + clientSession + ")[" + remoteAddress + "] unexpected invocation");
+            return false;
         };
 
         final AtomicInteger updateCount = new AtomicInteger(0);
@@ -128,12 +125,9 @@ public class KnownHostsServerKeyVerifierTest extends BaseTestSupport {
     @Test
     public void testFileUpdatedOnEveryNewHost() throws Exception {
         final AtomicInteger delegateCount = new AtomicInteger(0);
-        ServerKeyVerifier delegate = new ServerKeyVerifier() {
-            @Override
-            public boolean verifyServerKey(ClientSession clientSession, SocketAddress remoteAddress, PublicKey serverKey) {
-                delegateCount.incrementAndGet();
-                return true;
-            }
+        ServerKeyVerifier delegate = (clientSession, remoteAddress, serverKey) -> {
+            delegateCount.incrementAndGet();
+            return true;
         };
 
         Path path = getKnownHostCopyPath();
@@ -339,7 +333,7 @@ public class KnownHostsServerKeyVerifierTest extends BaseTestSupport {
             return Collections.emptyMap();
         }
 
-        Map<String, KnownHostEntry> hostsMap = new TreeMap<String, KnownHostEntry>(String.CASE_INSENSITIVE_ORDER);
+        Map<String, KnownHostEntry> hostsMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         for (KnownHostEntry entry : entries) {
             String line = entry.getConfigLine();
             outputDebugMessage("loadTestLines(%s) processing %s", file, line);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/scp/ScpTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/scp/ScpTest.java b/sshd-core/src/test/java/org/apache/sshd/client/scp/ScpTest.java
index 2ddc21b..66f17b3 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/scp/ScpTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/scp/ScpTest.java
@@ -1163,8 +1163,7 @@ public class ScpTest extends BaseTestSupport {
     }
 
     private static String readLine(InputStream in) throws IOException {
-        OutputStream baos = new ByteArrayOutputStream();
-        try {
+        try (OutputStream baos = new ByteArrayOutputStream()) {
             for (;;) {
                 int c = in.read();
                 if (c == '\n') {
@@ -1175,8 +1174,6 @@ public class ScpTest extends BaseTestSupport {
                     baos.write(c);
                 }
             }
-        } finally {
-            baos.close();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/session/ClientSessionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/session/ClientSessionTest.java b/sshd-core/src/test/java/org/apache/sshd/client/session/ClientSessionTest.java
index 9ab4ab3..2b14a4c 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/session/ClientSessionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/session/ClientSessionTest.java
@@ -84,23 +84,18 @@ public class ClientSessionTest extends BaseTestSupport {
     public void testDefaultExecuteCommandMethod() throws Exception {
         final String expectedCommand = getCurrentTestName() + "-CMD";
         final String expectedResponse = getCurrentTestName() + "-RSP";
-        sshd.setCommandFactory(new CommandFactory() {
-            @Override
-            public Command createCommand(String command) {
-                return new CommandExecutionHelper(command) {
-                    private boolean cmdProcessed;
+        sshd.setCommandFactory(command -> new CommandExecutionHelper(command) {
+            private boolean cmdProcessed;
 
-                    @Override
-                    protected boolean handleCommandLine(String command) throws Exception {
-                        assertEquals("Mismatched incoming command", expectedCommand, command);
-                        assertFalse("Duplicated command call", cmdProcessed);
-                        OutputStream stdout = getOut();
-                        stdout.write(expectedResponse.getBytes(StandardCharsets.US_ASCII));
-                        stdout.flush();
-                        cmdProcessed = true;
-                        return false;
-                    }
-                };
+            @Override
+            protected boolean handleCommandLine(String command) throws Exception {
+                assertEquals("Mismatched incoming command", expectedCommand, command);
+                assertFalse("Duplicated command call", cmdProcessed);
+                OutputStream stdout = getOut();
+                stdout.write(expectedResponse.getBytes(StandardCharsets.US_ASCII));
+                stdout.flush();
+                cmdProcessed = true;
+                return false;
             }
         });
 
@@ -118,23 +113,18 @@ public class ClientSessionTest extends BaseTestSupport {
     public void testExceptionThrownIfRemoteStderrWrittenTo() throws Exception {
         final String expectedCommand = getCurrentTestName() + "-CMD";
         final String expectedErrorMessage = getCurrentTestName() + "-ERR";
-        sshd.setCommandFactory(new CommandFactory() {
-            @Override
-            public Command createCommand(String command) {
-                return new CommandExecutionHelper(command) {
-                    private boolean cmdProcessed;
+        sshd.setCommandFactory(command -> new CommandExecutionHelper(command) {
+            private boolean cmdProcessed;
 
-                    @Override
-                    protected boolean handleCommandLine(String command) throws Exception {
-                        assertEquals("Mismatched incoming command", expectedCommand, command);
-                        assertFalse("Duplicated command call", cmdProcessed);
-                        OutputStream stderr = getErr();
-                        stderr.write(expectedErrorMessage.getBytes(StandardCharsets.US_ASCII));
-                        stderr.flush();
-                        cmdProcessed = true;
-                        return false;
-                    }
-                };
+            @Override
+            protected boolean handleCommandLine(String command) throws Exception {
+                assertEquals("Mismatched incoming command", expectedCommand, command);
+                assertFalse("Duplicated command call", cmdProcessed);
+                OutputStream stderr = getErr();
+                stderr.write(expectedErrorMessage.getBytes(StandardCharsets.US_ASCII));
+                stderr.flush();
+                cmdProcessed = true;
+                return false;
             }
         });
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
index 929e377..c4bcdbe 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
@@ -21,7 +21,6 @@ package org.apache.sshd.client.simple;
 
 import java.io.IOException;
 import java.security.KeyPair;
-import java.security.PublicKey;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -32,9 +31,7 @@ import org.apache.sshd.common.session.SessionListener;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.server.auth.password.PasswordAuthenticator;
 import org.apache.sshd.server.auth.password.RejectAllPasswordAuthenticator;
-import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
 import org.apache.sshd.server.auth.pubkey.RejectAllPublickeyAuthenticator;
-import org.apache.sshd.server.session.ServerSession;
 import org.apache.sshd.util.test.Utils;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -64,16 +61,13 @@ public class SimpleSessionClientTest extends BaseSimpleClientTestSupport {
     public void testLoginSessionWithIdentity() throws Exception {
         final KeyPair identity = Utils.getFirstKeyPair(createTestHostKeyProvider());
         final AtomicBoolean identityQueried = new AtomicBoolean(false);
-        sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
-            @Override
-            public boolean authenticate(String username, PublicKey key, ServerSession session) {
-                if (username.equals(getCurrentTestName())) {
-                    identityQueried.set(true);
-                    return KeyUtils.compareKeys(identity.getPublic(), key);
-                }
-
-                return false;
+        sshd.setPublickeyAuthenticator((username, key, session) -> {
+            if (username.equals(getCurrentTestName())) {
+                identityQueried.set(true);
+                return KeyUtils.compareKeys(identity.getPublic(), key);
             }
+
+            return false;
         });
         // make sure authentication occurs only with public keys
         sshd.setPasswordAuthenticator(RejectAllPasswordAuthenticator.INSTANCE);
@@ -116,16 +110,13 @@ public class SimpleSessionClientTest extends BaseSimpleClientTestSupport {
         // make sure authentication occurs only for passwords
         sshd.setPublickeyAuthenticator(RejectAllPublickeyAuthenticator.INSTANCE);
         final PasswordAuthenticator delegate = ValidateUtils.checkNotNull(sshd.getPasswordAuthenticator(), "No password authenticator");
-        sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
-            @Override
-            public boolean authenticate(String username, String password, ServerSession session) {
-                try {
-                    Thread.sleep(AUTH_TIMEOUT + 150L);
-                } catch (InterruptedException e) {
-                    // ignored
-                }
-                return delegate.authenticate(username, password, session);
+        sshd.setPasswordAuthenticator((username, password, session) -> {
+            try {
+                Thread.sleep(AUTH_TIMEOUT + 150L);
+            } catch (InterruptedException e) {
+                // ignored
             }
+            return delegate.authenticate(username, password, session);
         });
         client.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
index 1fb68e0..57c5998 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
@@ -88,7 +88,7 @@ public abstract class AbstractSftpClientTestSupport extends BaseTestSupport {
         sshd.setFileSystemFactory(fileSystemFactory);
     }
 
-    protected static final <E extends SftpClientExtension> E assertExtensionCreated(SftpClient sftp, Class<E> type) {
+    protected static <E extends SftpClientExtension> E assertExtensionCreated(SftpClient sftp, Class<E> type) {
         E instance = sftp.getExtension(type);
         assertNotNull("Extension not created: " + type.getSimpleName(), instance);
         assertTrue("Extension not supported: " + instance.getName(), instance.isSupported());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java
index fd8d94e..7d14e6c 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/DefaultCloseableHandleTest.java
@@ -31,8 +31,6 @@ import org.junit.Test;
 import org.junit.runners.MethodSorters;
 import org.mockito.Matchers;
 import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
@@ -47,14 +45,11 @@ public class DefaultCloseableHandleTest extends BaseTestSupport {
     public void testChannelBehavior() throws IOException {
         final byte[] id = getCurrentTestName().getBytes(StandardCharsets.UTF_8);
         SftpClient client = Mockito.mock(SftpClient.class);
-        Mockito.doAnswer(new Answer<Void>() {
-            @Override
-            public Void answer(InvocationOnMock invocation) throws Throwable {
-                Object[] args = invocation.getArguments();
-                Handle handle = (Handle) args[0];
-                assertArrayEquals("Mismatched closing handle", id, handle.getIdentifier());
-                return null;
-            }
+        Mockito.doAnswer(invocation -> {
+            Object[] args = invocation.getArguments();
+            Handle handle = (Handle) args[0];
+            assertArrayEquals("Mismatched closing handle", id, handle.getIdentifier());
+            return null;
         }).when(client).close(Matchers.any(Handle.class));
 
         CloseableHandle handle = new DefaultCloseableHandle(client, getCurrentTestName(), id);
@@ -72,13 +67,10 @@ public class DefaultCloseableHandleTest extends BaseTestSupport {
     public void testCloseIdempotent() throws IOException {
         SftpClient client = Mockito.mock(SftpClient.class);
         final AtomicBoolean closeCalled = new AtomicBoolean(false);
-        Mockito.doAnswer(new Answer<Void>() {
-            @Override
-            public Void answer(InvocationOnMock invocation) throws Throwable {
-                Object[] args = invocation.getArguments();
-                assertFalse("Close already called on handle=" + args[0], closeCalled.getAndSet(true));
-                return null;
-            }
+        Mockito.doAnswer(invocation -> {
+            Object[] args = invocation.getArguments();
+            assertFalse("Close already called on handle=" + args[0], closeCalled.getAndSet(true));
+            return null;
         }).when(client).close(Matchers.any(Handle.class));
 
         CloseableHandle handle = new DefaultCloseableHandle(client, getCurrentTestName(), getCurrentTestName().getBytes(StandardCharsets.UTF_8));

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
index cf661ef..d97ec36 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
@@ -116,14 +116,10 @@ public class SftpFileSystemTest extends BaseTestSupport {
     @Test
     public void testFileSystem() throws Exception {
         try (FileSystem fs = FileSystems.newFileSystem(createDefaultFileSystemURI(),
-                new TreeMap<String, Object>() {
-                    private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                    {
-                        put(SftpFileSystemProvider.READ_BUFFER_PROP_NAME, Integer.valueOf(IoUtils.DEFAULT_COPY_SIZE));
-                        put(SftpFileSystemProvider.WRITE_BUFFER_PROP_NAME, Integer.valueOf(IoUtils.DEFAULT_COPY_SIZE));
-                    }
-                })) {
+                GenericUtils.<String, Object>mapBuilder()
+                        .put(SftpFileSystemProvider.READ_BUFFER_PROP_NAME, IoUtils.DEFAULT_COPY_SIZE)
+                        .put(SftpFileSystemProvider.WRITE_BUFFER_PROP_NAME, IoUtils.DEFAULT_COPY_SIZE)
+                        .build())) {
             assertTrue("Not an SftpFileSystem", fs instanceof SftpFileSystem);
             testFileSystem(fs, ((SftpFileSystem) fs).getVersion());
         }
@@ -137,8 +133,8 @@ public class SftpFileSystemTest extends BaseTestSupport {
         params.put("test-name", getCurrentTestName());
 
         int expectedVersion = (SftpSubsystem.LOWER_SFTP_IMPL + SftpSubsystem.HIGHER_SFTP_IMPL) / 2;
-        params.put(SftpFileSystemProvider.VERSION_PARAM, Integer.valueOf(expectedVersion));
-        try (SftpFileSystem fs = (SftpFileSystem) FileSystems.newFileSystem(createDefaultFileSystemURI(params), Collections.emptyMap())) {
+        params.put(SftpFileSystemProvider.VERSION_PARAM, expectedVersion);
+        try (SftpFileSystem fs = (SftpFileSystem) FileSystems.newFileSystem(createDefaultFileSystemURI(params), Collections.<String, Object>emptyMap())) {
             try (SftpClient sftpClient = fs.getClient()) {
                 assertEquals("Mismatched negotiated version", expectedVersion, sftpClient.getVersion());
 
@@ -164,14 +160,10 @@ public class SftpFileSystemTest extends BaseTestSupport {
         Utils.deleteRecursive(lclSftp);
 
         try (FileSystem fs = FileSystems.newFileSystem(createDefaultFileSystemURI(),
-                new TreeMap<String, Object>() {
-                    private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                    {
-                        put(SftpFileSystemProvider.READ_BUFFER_PROP_NAME, Integer.valueOf(SftpClient.MIN_READ_BUFFER_SIZE));
-                        put(SftpFileSystemProvider.WRITE_BUFFER_PROP_NAME, Integer.valueOf(SftpClient.MIN_WRITE_BUFFER_SIZE));
-                    }
-                })) {
+                GenericUtils.<String, Object>mapBuilder()
+                    .put(SftpFileSystemProvider.READ_BUFFER_PROP_NAME, SftpClient.MIN_READ_BUFFER_SIZE)
+                    .put(SftpFileSystemProvider.WRITE_BUFFER_PROP_NAME, SftpClient.MIN_WRITE_BUFFER_SIZE)
+                    .build())) {
 
             Path parentPath = targetPath.getParent();
             Path clientFolder = lclSftp.resolve("client");
@@ -183,7 +175,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
             Map<String, Object> attrs = Files.readAttributes(file, "posix:*");
             assertNotNull("No attributes read for " + file, attrs);
 
-            Files.setAttribute(file, "basic:size", Long.valueOf(2L));
+            Files.setAttribute(file, "basic:size", 2L);
             Files.setAttribute(file, "posix:permissions", PosixFilePermissions.fromString("rwxr-----"));
             Files.setAttribute(file, "basic:lastModifiedTime", FileTime.fromMillis(100000L));
 
@@ -292,28 +284,14 @@ public class SftpFileSystemTest extends BaseTestSupport {
     @Test
     public void testSftpVersionSelector() throws Exception {
         final AtomicInteger selected = new AtomicInteger(-1);
-        SftpVersionSelector selector = new SftpVersionSelector() {
-            @Override
-            public int selectVersion(ClientSession session, int current, List<Integer> available) {
-                int numAvailable = GenericUtils.size(available);
-                Integer maxValue = null;
-                if (numAvailable == 1) {
-                    maxValue = available.get(0);
-                } else {
-                    for (Integer v : available) {
-                        if (v.intValue() == current) {
-                            continue;
-                        }
-
-                        if ((maxValue == null) || (maxValue.intValue() < v.intValue())) {
-                            maxValue = v;
-                        }
-                    }
-                }
-
-                selected.set(maxValue.intValue());
-                return selected.get();
-            }
+        SftpVersionSelector selector = (session, current, available) -> {
+            int value = GenericUtils.stream(available)
+                    .mapToInt(Integer::intValue)
+                    .filter(v -> v != current)
+                    .max()
+                    .orElseGet(() -> current);
+            selected.set(value);
+            return value;
         };
 
         try (SshClient client = setupTestClient()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java
index 996036a..79e25ea 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java
@@ -51,7 +51,6 @@ import java.util.concurrent.atomic.AtomicReference;
 
 import com.jcraft.jsch.ChannelSftp;
 import com.jcraft.jsch.JSch;
-
 import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.client.subsystem.sftp.SftpClient.CloseableHandle;
@@ -64,10 +63,8 @@ import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.OptionalFeature;
 import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.channel.WindowClosedException;
-import org.apache.sshd.common.file.FileSystemFactory;
 import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
 import org.apache.sshd.common.random.Random;
-import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
 import org.apache.sshd.common.subsystem.sftp.SftpException;
 import org.apache.sshd.common.subsystem.sftp.extensions.AclSupportedParser.AclCapabilities;
@@ -224,12 +221,7 @@ public class SftpTest extends AbstractSftpClientTestSupport {
     public void testNavigateBeyondRootFolder() throws Exception {
         Path rootLocation = Paths.get(OsUtils.isUNIX() ? "/" : "C:\\");
         final FileSystem fsRoot = rootLocation.getFileSystem();
-        sshd.setFileSystemFactory(new FileSystemFactory() {
-                @Override
-                public FileSystem createFileSystem(Session session) throws IOException {
-                    return fsRoot;
-                }
-            });
+        sshd.setFileSystemFactory(session1 -> fsRoot);
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
             session.addPasswordIdentity(getCurrentTestName());
@@ -1034,28 +1026,14 @@ public class SftpTest extends AbstractSftpClientTestSupport {
     @Test
     public void testSftpVersionSelector() throws Exception {
         final AtomicInteger selected = new AtomicInteger(-1);
-        SftpVersionSelector selector = new SftpVersionSelector() {
-            @Override
-            public int selectVersion(ClientSession session, int current, List<Integer> available) {
-                int numAvailable = GenericUtils.size(available);
-                Integer maxValue = null;
-                if (numAvailable == 1) {
-                    maxValue = available.get(0);
-                } else {
-                    for (Integer v : available) {
-                        if (v.intValue() == current) {
-                            continue;
-                        }
-
-                        if ((maxValue == null) || (maxValue.intValue() < v.intValue())) {
-                            maxValue = v;
-                        }
-                    }
-                }
-
-                selected.set(maxValue.intValue());
-                return selected.get();
-            }
+        SftpVersionSelector selector = (session, current, available) -> {
+            int value = GenericUtils.stream(available)
+                    .mapToInt(Integer::intValue)
+                    .filter(v -> v != current)
+                    .max()
+                    .orElseGet(() -> current);
+            selected.set(value);
+            return value;
         };
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java
index ba0d456..3447bdc 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java
@@ -48,9 +48,8 @@ public class SftpVersionSelectorTest extends BaseTestSupport {
         Random rnd = new Random(System.nanoTime());
         ClientSession session = Mockito.mock(ClientSession.class);
         for (int expected = SftpSubsystem.LOWER_SFTP_IMPL; expected <= SftpSubsystem.HIGHER_SFTP_IMPL; expected++) {
-            assertEquals("Mismatched directly selected for available=" + available,
-                    expected, SftpVersionSelector.CURRENT.selectVersion(session, expected, available));
-            available.add(Integer.valueOf(expected));
+            assertEquals("Mismatched directly selected for available=" + available, expected, SftpVersionSelector.CURRENT.selectVersion(session, expected, available));
+            available.add(expected);
         }
 
         for (int expected = SftpSubsystem.LOWER_SFTP_IMPL; expected <= SftpSubsystem.HIGHER_SFTP_IMPL; expected++) {
@@ -65,14 +64,14 @@ public class SftpVersionSelectorTest extends BaseTestSupport {
     @Test
     public void testFixedVersionSelector() {
         final int fixedValue = 7365;
-        testVersionSelector(SftpVersionSelector.Utils.fixedVersionSelector(fixedValue), fixedValue);
+        testVersionSelector(SftpVersionSelector.fixedVersionSelector(fixedValue), fixedValue);
     }
 
     @Test
     public void testPreferredVersionSelector() {
         List<Integer> available = new ArrayList<>();
         for (int version = SftpSubsystem.LOWER_SFTP_IMPL; version <= SftpSubsystem.HIGHER_SFTP_IMPL; version++) {
-            available.add(Integer.valueOf(version));
+            available.add(version);
         }
 
         List<Integer> preferred = new ArrayList<>(available);
@@ -81,7 +80,7 @@ public class SftpVersionSelectorTest extends BaseTestSupport {
         ClientSession session = Mockito.mock(ClientSession.class);
         for (int index = 0; index < preferred.size(); index++) {
             Collections.shuffle(preferred, rnd);
-            SftpVersionSelector selector = SftpVersionSelector.Utils.preferredVersionSelector(preferred);
+            SftpVersionSelector selector = SftpVersionSelector.preferredVersionSelector(preferred);
             int expected = preferred.get(0);
 
             for (int current = SftpSubsystem.LOWER_SFTP_IMPL; current <= SftpSubsystem.HIGHER_SFTP_IMPL; current++) {
@@ -116,7 +115,7 @@ public class SftpVersionSelectorTest extends BaseTestSupport {
     private static void testVersionSelector(SftpVersionSelector selector, int expected) {
         List<Integer> available = new ArrayList<>();
         for (int version = SftpSubsystem.LOWER_SFTP_IMPL; version <= SftpSubsystem.HIGHER_SFTP_IMPL; version++) {
-            available.add(Integer.valueOf(version));
+            available.add(version);
         }
 
         Random rnd = new Random(System.nanoTime());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
index ad29b74..58d2eed 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
@@ -39,6 +39,8 @@ import java.util.TreeMap;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
 
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.client.subsystem.sftp.SftpClient.Attributes;
@@ -71,15 +73,9 @@ import org.junit.runners.Parameterized.Parameters;
 @RunWith(Parameterized.class)   // see https://github.com/junit-team/junit/wiki/Parameterized-tests
 public class SftpVersionsTest extends AbstractSftpClientTestSupport {
     private static final List<Integer> VERSIONS =
-            Collections.unmodifiableList(new ArrayList<Integer>() {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    for (int version = SftpSubsystem.LOWER_SFTP_IMPL; version <= SftpSubsystem.HIGHER_SFTP_IMPL; version++) {
-                        add(Integer.valueOf(version));
-                    }
-                }
-            });
+            Collections.unmodifiableList(
+                    IntStream.rangeClosed(SftpSubsystem.LOWER_SFTP_IMPL, SftpSubsystem.HIGHER_SFTP_IMPL)
+                            .boxed().collect(Collectors.toList()));
 
     private final int testVersion;
 
@@ -308,15 +304,11 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport {
     @Test   // see SSHD-575
     public void testSftpExtensionsEncodeDecode() throws Exception {
         final Class<?> anchor = getClass();
-        final Map<String, String> expExtensions = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER) {
-            private static final long serialVersionUID = 1L;    // we're not serializing it
-
-            {
-                put("class", anchor.getSimpleName());
-                put("package", anchor.getPackage().getName());
-                put("method", getCurrentTestName());
-            }
-        };
+        final Map<String, String> expExtensions = GenericUtils.<String, String>mapBuilder()
+                .put("class", anchor.getSimpleName())
+                .put("package", anchor.getPackage().getName())
+                .put("method", getCurrentTestName())
+                .build();
 
         final AtomicInteger numInvocations = new AtomicInteger(0);
         SftpSubsystemFactory factory = new SftpSubsystemFactory() {
@@ -439,7 +431,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport {
                             assertNull("Unexpected indicator value at iteration #" + index, value);
                         } else {
                             assertNotNull("No indicator returned at iteration #" + index, value);
-                            if (value.booleanValue()) {
+                            if (value) {
                                 break;
                             }
                         }
@@ -453,7 +445,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport {
                     } else {
                         assertNotNull("No end-of-list indication received at end of entries", value);
                         assertNotNull("No last received entries", entries);
-                        assertTrue("Bad end-of-list value", value.booleanValue());
+                        assertTrue("Bad end-of-list value", value);
                     }
                 }
             }


[09/16] mina-sshd git commit: [SSHD-698] Use lambda and method references, streams Deprecate Utils inner classes and use interface methods instead.

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureFactoriesTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureFactoriesTest.java b/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureFactoriesTest.java
index 4896c5e..8b60bf0 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureFactoriesTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureFactoriesTest.java
@@ -78,27 +78,22 @@ public class SignatureFactoriesTest extends BaseTestSupport {
 
     @Parameters(name = "type={0}, size={2}")
     public static List<Object[]> parameters() {
-        return Collections.unmodifiableList(new ArrayList<Object[]>() {
-            // Not serializing it
-            private static final long serialVersionUID = 1L;
-
-            {
-                addTests(KeyPairProvider.SSH_DSS, BuiltinSignatures.dsa, DSS_SIZES, DSSPublicKeyEntryDecoder.INSTANCE);
-                addTests(KeyPairProvider.SSH_RSA, BuiltinSignatures.rsa, RSA_SIZES, RSAPublicKeyDecoder.INSTANCE);
-                if (SecurityUtils.hasEcc()) {
-                    for (ECCurves curve : ECCurves.VALUES) {
-                        BuiltinSignatures factory = BuiltinSignatures.fromFactoryName(curve.getKeyType());
-                        addTests(curve.getName(), factory, Collections.singletonList(curve.getKeySize()), ECDSAPublicKeyEntryDecoder.INSTANCE);
-                    }
-                }
+        List<Object[]> list = new ArrayList<>();
+        addTests(list, KeyPairProvider.SSH_DSS, BuiltinSignatures.dsa, DSS_SIZES, DSSPublicKeyEntryDecoder.INSTANCE);
+        addTests(list, KeyPairProvider.SSH_RSA, BuiltinSignatures.rsa, RSA_SIZES, RSAPublicKeyDecoder.INSTANCE);
+        if (SecurityUtils.hasEcc()) {
+            for (ECCurves curve : ECCurves.VALUES) {
+                BuiltinSignatures factory = BuiltinSignatures.fromFactoryName(curve.getKeyType());
+                addTests(list, curve.getName(), factory, Collections.singletonList(curve.getKeySize()), ECDSAPublicKeyEntryDecoder.INSTANCE);
             }
+        }
+        return Collections.unmodifiableList(list);
+    }
 
-            private void addTests(String keyType, NamedFactory<Signature> factory, Collection<Integer> sizes, PublicKeyEntryDecoder<?, ?> decoder) {
-                for (Integer keySize : sizes) {
-                    add(new Object[]{keyType, factory, keySize, decoder});
-                }
-            }
-        });
+    private static void addTests(List<Object[]> list, String keyType, NamedFactory<Signature> factory, Collection<Integer> sizes, PublicKeyEntryDecoder<?, ?> decoder) {
+        for (Integer keySize : sizes) {
+            list.add(new Object[]{keyType, factory, keySize, decoder});
+        }
     }
 
     @BeforeClass
@@ -146,16 +141,13 @@ public class SignatureFactoriesTest extends BaseTestSupport {
     protected void testKeyPairProvider(
             final String keyName, final int keySize, final PublicKeyEntryDecoder<?, ?> decoder, List<NamedFactory<Signature>> signatures)
                     throws Exception {
-        testKeyPairProvider(keyName, new Factory<Iterable<KeyPair>>() {
-            @Override
-            public Iterable<KeyPair> create() {
-                try {
-                    KeyPair kp = decoder.generateKeyPair(keySize);
-                    outputDebugMessage("Generated key pair for %s - key size=%d", keyName, keySize);
-                    return Collections.singletonList(kp);
-                } catch (Exception e) {
-                    throw new RuntimeSshException(e);
-                }
+        testKeyPairProvider(keyName, () -> {
+            try {
+                KeyPair kp = decoder.generateKeyPair(keySize);
+                outputDebugMessage("Generated key pair for %s - key size=%d", keyName, keySize);
+                return Collections.singletonList(kp);
+            } catch (Exception e) {
+                throw new RuntimeSshException(e);
             }
         }, signatures);
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureRSATest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureRSATest.java b/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureRSATest.java
index d12e7e3..b631be7 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureRSATest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/signature/SignatureRSATest.java
@@ -86,20 +86,15 @@ public class SignatureRSATest extends BaseTestSupport {
 
     @Test   // see SSHD-642
     public void testLeadingZeroesJCE() throws Throwable {
-        testLeadingZeroes(new Factory<SignatureRSA>() {
+        testLeadingZeroes(() -> new SignatureRSA() {
             @Override
-            public SignatureRSA create() {
-                return new SignatureRSA() {
-                    @Override
-                    protected java.security.Signature doInitSignature(String algo, boolean forSigning) throws GeneralSecurityException {
-                        assertFalse("Signature not initialized for verification", forSigning);
-                        java.security.Signature signature = java.security.Signature.getInstance(algo);
-                        Provider provider = signature.getProvider();
-                        String name = provider.getName();
-                        assertNotEquals("BC provider used although not required", SecurityUtils.BOUNCY_CASTLE, name);
-                        return signature;
-                    }
-                };
+            protected java.security.Signature doInitSignature(String algo, boolean forSigning) throws GeneralSecurityException {
+                assertFalse("Signature not initialized for verification", forSigning);
+                java.security.Signature signature = java.security.Signature.getInstance(algo);
+                Provider provider = signature.getProvider();
+                String name = provider.getName();
+                assertNotEquals("BC provider used although not required", SecurityUtils.BOUNCY_CASTLE, name);
+                return signature;
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
index 4db0e0a..7d9587c 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
@@ -49,7 +49,7 @@ public class EventListenerUtilsTest extends BaseTestSupport {
 
         ProxyListener listener = EventListenerUtils.proxyWrapper(ProxyListener.class, impls);
         String expStr = getCurrentTestName();
-        Number expNum = Long.valueOf(System.currentTimeMillis());
+        Number expNum = System.currentTimeMillis();
         listener.callMeWithString(expStr);
         listener.callMeWithNumber(expNum);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/util/NumberUtilsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/NumberUtilsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/NumberUtilsTest.java
index ed42e02..537d055 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/NumberUtilsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/NumberUtilsTest.java
@@ -39,14 +39,14 @@ public class NumberUtilsTest extends BaseTestSupport {
         long expected = 1L;
         for (int index = 0; index < Long.SIZE; index++, expected <<= 1) {
             Long actual = NumberUtils.POWERS_OF_TWO.get(index);
-            assertEquals("Mismatched value at index=" + index, Long.toHexString(expected), Long.toHexString(actual.longValue()));
+            assertEquals("Mismatched value at index=" + index, Long.toHexString(expected), Long.toHexString(actual));
         }
     }
 
     @Test
     public void testNextPowerOf2() {
         for (Long v : NumberUtils.POWERS_OF_TWO) {
-            long expected = v.longValue();
+            long expected = v;
             if (expected > 2L) {
                 assertEquals("Mismatched lower bound value", expected, NumberUtils.getNextPowerOf2(expected - 1L));
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/util/SecurityUtilsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/SecurityUtilsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/SecurityUtilsTest.java
index f2f57d2..310fb79 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/SecurityUtilsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/SecurityUtilsTest.java
@@ -19,7 +19,6 @@
 
 package org.apache.sshd.common.util;
 
-import java.io.IOException;
 import java.nio.file.Path;
 import java.security.GeneralSecurityException;
 import java.security.KeyPair;
@@ -56,12 +55,7 @@ import org.junit.runners.MethodSorters;
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class SecurityUtilsTest extends BaseTestSupport {
     private static final String DEFAULT_PASSWORD = "super secret passphrase";
-    private static final FilePasswordProvider TEST_PASSWORD_PROVIDER = new FilePasswordProvider() {
-        @Override
-        public String getPassword(String file) throws IOException {
-            return DEFAULT_PASSWORD;
-        }
-    };
+    private static final FilePasswordProvider TEST_PASSWORD_PROVIDER = file -> DEFAULT_PASSWORD;
 
     public SecurityUtilsTest() {
         super();
@@ -157,7 +151,7 @@ public class SecurityUtilsTest extends BaseTestSupport {
             Class<? extends PublicKey> pubType, Class<? extends PrivateKey> prvType) {
         provider.setPasswordFinder(TEST_PASSWORD_PROVIDER);
         Iterable<KeyPair> iterator = provider.loadKeys();
-        List<KeyPair> pairs = new ArrayList<KeyPair>();
+        List<KeyPair> pairs = new ArrayList<>();
         for (KeyPair kp : iterator) {
             pairs.add(kp);
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/util/TransformerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/TransformerTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/TransformerTest.java
index a74d2e0..063112b 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/TransformerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/TransformerTest.java
@@ -59,14 +59,14 @@ public class TransformerTest extends BaseTestSupport {
 
     @Test
     public void testSingletonIdentityInstance() {
-        Transformer<Date, Date> dateTransformer = Transformer.Utils.identity();
-        Transformer<String, String> stringTransformer = Transformer.Utils.identity();
+        Transformer<Date, Date> dateTransformer = Transformer.identity();
+        Transformer<String, String> stringTransformer = Transformer.identity();
         assertSame("Mismatched identity instance", dateTransformer, stringTransformer);
     }
 
     @Test
     public void testIdentity() {
-        Transformer<Object, Object> identity = Transformer.Utils.identity();
+        Transformer<Object, Object> identity = Transformer.identity();
         for (Object expected : new Object[]{null, getClass(), getCurrentTestName()}) {
             Object actual = identity.transform(expected);
             assertSame("Mismatched identity result", expected, actual);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/util/closeable/CloseableUtilsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/closeable/CloseableUtilsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/closeable/CloseableUtilsTest.java
index 8605d2d..f8f5a0d 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/closeable/CloseableUtilsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/closeable/CloseableUtilsTest.java
@@ -142,14 +142,11 @@ public class CloseableUtilsTest extends BaseTestSupport {
         };
         ExecutorService service = ThreadUtils.newSingleThreadExecutor(getCurrentTestName());
         try {
-            Future<?> task = service.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        closeable.close();
-                    } catch (IOException e) {
-                        throw new RuntimeException(e);
-                    }
+            Future<?> task = service.submit((Runnable) () -> {
+                try {
+                    closeable.close();
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
                 }
             });
             future.setClosed();  // signal close complete

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
index 8907b2e..5f025cc 100644
--- a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
+++ b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
@@ -121,7 +121,7 @@ public class UserAuthAgent extends AbstractUserAuth {
                 }
             } else {
                 // TODO: check packets
-                log.info("Received unknown packet: {}", Integer.valueOf(cmd));
+                log.info("Received unknown packet: {}", cmd);
                 return Result.Continued;
             }
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthKeyboardInteractive.java b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthKeyboardInteractive.java
index bfa6a1d..f6f301e 100644
--- a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthKeyboardInteractive.java
@@ -113,7 +113,7 @@ public class UserAuthKeyboardInteractive extends AbstractUserAuth {
                         return Result.Failure;
                     }
                 default:
-                    log.debug("Received unknown packet {}", Integer.valueOf(cmd));
+                    log.debug("Received unknown packet {}", cmd);
                     return Result.Continued;
             }
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPassword.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPassword.java b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPassword.java
index df420b8..bb61fba 100644
--- a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPassword.java
+++ b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPassword.java
@@ -68,7 +68,7 @@ public class UserAuthPassword extends AbstractUserAuth {
                 return Result.Failure;
             } else {
                 if (log.isDebugEnabled()) {
-                    log.debug("Received unkown packet {}", Integer.valueOf(cmd & 0xFF));
+                    log.debug("Received unkown packet {}", cmd & 0xFF);
                 }
                 // TODO: check packets
                 return Result.Continued;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
index 6593c0a..dd73fbd 100644
--- a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
+++ b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
@@ -62,7 +62,7 @@ public class UserAuthPublicKey extends AbstractUserAuth {
                 buffer.putPublicKey(key.getPublic());
 
                 Signature verif =
-                        ValidateUtils.checkNotNull(NamedFactory.Utils.create(session.getSignatureFactories(), alg),
+                        ValidateUtils.checkNotNull(NamedFactory.create(session.getSignatureFactories(), alg),
                                 "No signature factory located for algorithm=%s",
                                 alg);
                 verif.initSigner(key.getPrivate());
@@ -105,7 +105,7 @@ public class UserAuthPublicKey extends AbstractUserAuth {
                 }
                 return Result.Failure;
             } else {
-                log.debug("Received unknown packet {}", Integer.valueOf(cmd));
+                log.debug("Received unknown packet {}", cmd);
                 // TODO: check packets
                 return Result.Continued;
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/ServerAuthenticationManagerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerAuthenticationManagerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerAuthenticationManagerTest.java
index 75d49ae..947f12c 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerAuthenticationManagerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerAuthenticationManagerTest.java
@@ -113,7 +113,7 @@ public class ServerAuthenticationManagerTest extends BaseTestSupport {
         };
         assertEquals("Mismatched initial factories list", "", manager.getUserAuthFactoriesNameList());
 
-        String expected = NamedResource.Utils.getNames(BuiltinUserAuthFactories.VALUES);
+        String expected = NamedResource.getNames(BuiltinUserAuthFactories.VALUES);
         manager.setUserAuthFactoriesNameList(expected);
         assertEquals("Mismatched updated factories names", expected, manager.getUserAuthFactoriesNameList());
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java
index 8b37999..ae59e12 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java
@@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.sshd.client.SshClient;
-import org.apache.sshd.client.session.ClientProxyConnector;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.io.IoSession;
 import org.apache.sshd.common.session.Session;
@@ -129,12 +128,9 @@ public class ServerProxyAcceptorTest extends BaseTestSupport {
         });
         sshd.start();
 
-        client.setClientProxyConnector(new ClientProxyConnector() {
-            @Override
-            public void sendClientProxyMetadata(ClientSession session) throws Exception {
-                IoSession ioSession = session.getIoSession();
-                ioSession.write(new ByteArrayBuffer(metaDataBytes));
-            }
+        client.setClientProxyConnector(session -> {
+            IoSession ioSession = session.getIoSession();
+            ioSession.write(new ByteArrayBuffer(metaDataBytes));
         });
         client.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
index 56122c8..5430e59 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
@@ -43,7 +43,6 @@ import org.apache.sshd.common.session.SessionListener;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.server.auth.keyboard.KeyboardInteractiveAuthenticator;
 import org.apache.sshd.server.auth.password.PasswordAuthenticator;
-import org.apache.sshd.server.auth.password.PasswordChangeRequiredException;
 import org.apache.sshd.server.session.ServerSession;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.Utils;
@@ -199,12 +198,9 @@ public class ServerSessionListenerTest extends BaseTestSupport {
     public void testSessionListenerCanModifyAuthentication() throws Exception {
         final AtomicInteger passCount = new AtomicInteger(0);
         final PasswordAuthenticator defaultPassAuth = sshd.getPasswordAuthenticator();
-        final PasswordAuthenticator passAuth = new PasswordAuthenticator() {
-            @Override
-            public boolean authenticate(String username, String password, ServerSession session) throws PasswordChangeRequiredException {
-                passCount.incrementAndGet();
-                return defaultPassAuth.authenticate(username, password, session);
-            }
+        final PasswordAuthenticator passAuth = (username, password, session) -> {
+            passCount.incrementAndGet();
+            return defaultPassAuth.authenticate(username, password, session);
         };
         SessionListener listener = new SessionListener() {
             @Override
@@ -214,7 +210,7 @@ public class ServerSessionListenerTest extends BaseTestSupport {
                     serverSession.setPasswordAuthenticator(passAuth);
                     serverSession.setUserAuthFactories(
                             Collections.singletonList(
-                                    ServerAuthenticationManager.Utils.DEFAULT_USER_AUTH_PASSWORD_FACTORY));
+                                    ServerAuthenticationManager.DEFAULT_USER_AUTH_PASSWORD_FACTORY));
                 }
             }
         };

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
index 7f75b01..7354c20 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
@@ -32,7 +32,6 @@ import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
-import java.util.TreeMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Semaphore;
@@ -515,46 +514,43 @@ public class ServerTest extends BaseTestSupport {
     @Test   // see SSHD-645
     public void testChannelStateChangeNotifications() throws Exception {
         final Semaphore exitSignal = new Semaphore(0);
-        sshd.setCommandFactory(new CommandFactory() {
-            @Override
-            public Command createCommand(final String command) {
-                ValidateUtils.checkTrue(String.CASE_INSENSITIVE_ORDER.compare(command, getCurrentTestName()) == 0, "Unexpected command: %s", command);
+        sshd.setCommandFactory(command -> {
+            ValidateUtils.checkTrue(String.CASE_INSENSITIVE_ORDER.compare(command, getCurrentTestName()) == 0, "Unexpected command: %s", command);
 
-                return new Command() {
-                    private ExitCallback cb;
+            return new Command() {
+                private ExitCallback cb;
 
-                    @Override
-                    public void setOutputStream(OutputStream out) {
-                        // ignored
-                    }
+                @Override
+                public void setOutputStream(OutputStream out) {
+                    // ignored
+                }
 
-                    @Override
-                    public void setInputStream(InputStream in) {
-                        // ignored
-                    }
+                @Override
+                public void setInputStream(InputStream in) {
+                    // ignored
+                }
 
-                    @Override
-                    public void setExitCallback(ExitCallback callback) {
-                        cb = callback;
-                    }
+                @Override
+                public void setExitCallback(ExitCallback callback) {
+                    cb = callback;
+                }
 
-                    @Override
-                    public void setErrorStream(OutputStream err) {
-                        // ignored
-                    }
+                @Override
+                public void setErrorStream(OutputStream err) {
+                    // ignored
+                }
 
-                    @Override
-                    public void destroy() {
-                        // ignored
-                    }
+                @Override
+                public void destroy() {
+                    // ignored
+                }
 
-                    @Override
-                    public void start(Environment env) throws IOException {
-                        exitSignal.release();
-                        cb.onExit(0, command);
-                    }
-                };
-            }
+                @Override
+                public void start(Environment env) throws IOException {
+                    exitSignal.release();
+                    cb.onExit(0, command);
+                }
+            };
         });
         sshd.start();
         client.start();
@@ -591,49 +587,46 @@ public class ServerTest extends BaseTestSupport {
     @Test
     public void testEnvironmentVariablesPropagationToServer() throws Exception {
         final AtomicReference<Environment> envHolder = new AtomicReference<>(null);
-        sshd.setCommandFactory(new CommandFactory() {
-            @Override
-            public Command createCommand(final String command) {
-                ValidateUtils.checkTrue(String.CASE_INSENSITIVE_ORDER.compare(command, getCurrentTestName()) == 0, "Unexpected command: %s", command);
-
-                return new Command() {
-                    private ExitCallback cb;
+        sshd.setCommandFactory(command -> {
+            ValidateUtils.checkTrue(String.CASE_INSENSITIVE_ORDER.compare(command, getCurrentTestName()) == 0, "Unexpected command: %s", command);
 
-                    @Override
-                    public void setOutputStream(OutputStream out) {
-                        // ignored
-                    }
+            return new Command() {
+                private ExitCallback cb;
 
-                    @Override
-                    public void setInputStream(InputStream in) {
-                        // ignored
-                    }
+                @Override
+                public void setOutputStream(OutputStream out) {
+                    // ignored
+                }
 
-                    @Override
-                    public void setExitCallback(ExitCallback callback) {
-                        cb = callback;
-                    }
+                @Override
+                public void setInputStream(InputStream in) {
+                    // ignored
+                }
 
-                    @Override
-                    public void setErrorStream(OutputStream err) {
-                        // ignored
-                    }
+                @Override
+                public void setExitCallback(ExitCallback callback) {
+                    cb = callback;
+                }
 
-                    @Override
-                    public void destroy() {
-                        // ignored
-                    }
+                @Override
+                public void setErrorStream(OutputStream err) {
+                    // ignored
+                }
 
-                    @Override
-                    public void start(Environment env) throws IOException {
-                        if (envHolder.getAndSet(env) != null) {
-                            throw new StreamCorruptedException("Multiple starts for command=" + command);
-                        }
+                @Override
+                public void destroy() {
+                    // ignored
+                }
 
-                        cb.onExit(0, command);
+                @Override
+                public void start(Environment env) throws IOException {
+                    if (envHolder.getAndSet(env) != null) {
+                        throw new StreamCorruptedException("Multiple starts for command=" + command);
                     }
-                };
-            }
+
+                    cb.onExit(0, command);
+                }
+            };
         });
 
         TestChannelListener channelListener = new TestChannelListener();
@@ -641,15 +634,12 @@ public class ServerTest extends BaseTestSupport {
         sshd.start();
 
         @SuppressWarnings("synthetic-access")
-        Map<String, String> expected = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER) {
-            private static final long serialVersionUID = 1L;    // we're not serializing it
-
-            {
-                put("test", getCurrentTestName());
-                put("port", Integer.toString(sshd.getPort()));
-                put("user", OsUtils.getCurrentUser());
-            }
-        };
+        Map<String, String> expected =
+                GenericUtils.<String, String>mapBuilder(String.CASE_INSENSITIVE_ORDER)
+                    .put("test", getCurrentTestName())
+                    .put("port", Integer.toString(sshd.getPort()))
+                    .put("user", OsUtils.getCurrentUser())
+                    .build();
 
         client.start();
         try (ClientSession s = createTestClientSession(sshd);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/StandardEnvironmentTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/StandardEnvironmentTest.java b/sshd-core/src/test/java/org/apache/sshd/server/StandardEnvironmentTest.java
index 171b361..d1eaaa2 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/StandardEnvironmentTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/StandardEnvironmentTest.java
@@ -39,11 +39,8 @@ public class StandardEnvironmentTest extends BaseTestSupport {
     @Test
     public void testAddSignalListenerOnDuplicateSignals() {
         StandardEnvironment environ = new StandardEnvironment();
-        SignalListener listener = new SignalListener() {
-            @Override
-            public void signal(Signal signal) {
-                // ignored
-            }
+        SignalListener listener = signal -> {
+            // ignored
         };
 
         for (Signal s : Signal.SIGNALS) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
index e62e8de..04bf7d6 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
@@ -109,12 +109,12 @@ public class WelcomeBannerTest extends BaseTestSupport {
 
     @Test
     public void testFileBanner() throws Exception {
-        testFileContentBanner(path -> path.toFile());
+        testFileContentBanner(Path::toFile);
     }
 
     @Test
     public void testURIBanner() throws Exception {
-        testFileContentBanner(path -> path.toUri());
+        testFileContentBanner(Path::toUri);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
index 4cc8fc5..7a077a4 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
@@ -26,8 +26,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.channel.ChannelAsyncOutputStream;
 import org.apache.sshd.common.channel.Window;
-import org.apache.sshd.common.future.CloseFuture;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
 import org.apache.sshd.util.test.BaseTestSupport;
@@ -78,12 +76,9 @@ public class ChannelSessionTest extends BaseTestSupport {
                 wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
             }
         }) {
-            session.addCloseFutureListener(new SshFutureListener<CloseFuture>() {
-                @Override
-                public void operationComplete(CloseFuture future) {
-                    assertTrue("Future not marted as closed", future.isClosed());
-                    assertEquals("Unexpected multiple call to callback", 1, closeCount.incrementAndGet());
-                }
+            session.addCloseFutureListener(future -> {
+                assertTrue("Future not marted as closed", future.isClosed());
+                assertEquals("Unexpected multiple call to callback", 1, closeCount.incrementAndGet());
             });
             session.close();
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/config/keys/ServerIdentityTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/config/keys/ServerIdentityTest.java b/sshd-core/src/test/java/org/apache/sshd/server/config/keys/ServerIdentityTest.java
index 2674244..7f654ba 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/config/keys/ServerIdentityTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/config/keys/ServerIdentityTest.java
@@ -55,7 +55,7 @@ public class ServerIdentityTest extends BaseTestSupport {
         Assume.assumeTrue("BouncyCastle not registered", SecurityUtils.isBouncyCastleRegistered());
 
         Path resFolder = getClassResourcesFolder(TEST_SUBFOLDER, getClass());
-        Collection<Path> paths = new ArrayList<Path>(BuiltinIdentities.VALUES.size());
+        Collection<Path> paths = new ArrayList<>(BuiltinIdentities.VALUES.size());
         LinkOption[] options = IoUtils.getLinkOptions(false);
         Collection<BuiltinIdentities> expected = EnumSet.noneOf(BuiltinIdentities.class);
         for (BuiltinIdentities type : BuiltinIdentities.VALUES) {
@@ -81,7 +81,7 @@ public class ServerIdentityTest extends BaseTestSupport {
         Map<String, KeyPair> ids = ServerIdentity.loadIdentities(props, options);
         assertEquals("Mismatched loaded ids count", GenericUtils.size(paths), GenericUtils.size(ids));
 
-        Collection<KeyPair> pairs = new ArrayList<KeyPair>(ids.size());
+        Collection<KeyPair> pairs = new ArrayList<>(ids.size());
         for (BuiltinIdentities type : BuiltinIdentities.VALUES) {
             if (expected.contains(type)) {
                 KeyPair kp = ids.get(type.getName());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticatorTest.java b/sshd-core/src/test/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticatorTest.java
index 3ac6e28..a37ab85 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticatorTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticatorTest.java
@@ -59,7 +59,7 @@ public class JaasPasswordAuthenticatorTest extends BaseTestSupport {
                 return new AppConfigurationEntry[]{
                     new AppConfigurationEntry(DummyLoginModule.class.getName(),
                             AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
-                            new HashMap<String, Object>())
+                            new HashMap<>())
                 };
             }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterInputStreamTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterInputStreamTest.java b/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterInputStreamTest.java
index b819984..58e4407 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterInputStreamTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterInputStreamTest.java
@@ -23,7 +23,6 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -31,6 +30,8 @@ import java.util.Date;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import org.apache.sshd.common.channel.PtyMode;
 import org.apache.sshd.common.util.GenericUtils;
@@ -51,17 +52,10 @@ import org.junit.runners.Parameterized.Parameters;
 @RunWith(Parameterized.class)   // see https://github.com/junit-team/junit/wiki/Parameterized-tests
 public class TtyFilterInputStreamTest extends BaseTestSupport {
     private static final List<PtyMode> MODES =
-            Collections.unmodifiableList(new ArrayList<PtyMode>(TtyFilterInputStream.INPUT_OPTIONS.size() + 2) {
-                private static final long serialVersionUID = 1L;    // we-re not serializing it
-
-                {
-                    add(PtyMode.ECHO);  // NO-OP
-
-                    for (PtyMode m : TtyFilterInputStream.INPUT_OPTIONS) {
-                        add(m);
-                    }
-                }
-            });
+            Collections.unmodifiableList(
+                    Stream.concat(Stream.of(PtyMode.ECHO),
+                                  TtyFilterInputStream.INPUT_OPTIONS.stream())
+                    .collect(Collectors.toList()));
 
     private final PtyMode mode;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/spring/SpringConfigTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/spring/SpringConfigTest.java b/sshd-core/src/test/java/org/apache/sshd/spring/SpringConfigTest.java
index 3501208..76c9534 100644
--- a/sshd-core/src/test/java/org/apache/sshd/spring/SpringConfigTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/spring/SpringConfigTest.java
@@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
 
 import com.jcraft.jsch.Channel;
 import com.jcraft.jsch.JSch;
-
 import org.apache.sshd.common.util.OsUtils;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.util.test.BaseTestSupport;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/util/test/AsyncEchoShellFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/AsyncEchoShellFactory.java b/sshd-core/src/test/java/org/apache/sshd/util/test/AsyncEchoShellFactory.java
index 4623a52..8867f2e 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/AsyncEchoShellFactory.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/AsyncEchoShellFactory.java
@@ -26,11 +26,8 @@ import java.nio.charset.StandardCharsets;
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.channel.BufferedIoOutputStream;
 import org.apache.sshd.common.channel.Window;
-import org.apache.sshd.common.future.CloseFuture;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.io.IoInputStream;
 import org.apache.sshd.common.io.IoOutputStream;
-import org.apache.sshd.common.io.IoWriteFuture;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
 import org.apache.sshd.server.AsyncCommand;
@@ -122,13 +119,7 @@ public class AsyncEchoShellFactory implements Factory<Command> {
 
         @Override
         public void close() throws IOException {
-            out.close(false).addListener(new SshFutureListener<CloseFuture>() {
-                @SuppressWarnings("synthetic-access")
-                @Override
-                public void operationComplete(CloseFuture future) {
-                    callback.onExit(0);
-                }
-            });
+            out.close(false).addListener(future -> callback.onExit(0));
         }
 
         @Override
@@ -143,21 +134,18 @@ public class AsyncEchoShellFactory implements Factory<Command> {
                 if (buffer.charAt(i) == '\n') {
                     final String s = buffer.substring(0, i + 1);
                     final byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
-                    out.write(new ByteArrayBuffer(bytes)).addListener(new SshFutureListener<IoWriteFuture>() {
-                        @Override
-                        public void operationComplete(IoWriteFuture future) {
-                            Session session = channel.getSession();
-                            if (future.isWritten()) {
-                                try {
-                                    Window wLocal = channel.getLocalWindow();
-                                    wLocal.consumeAndCheck(bytes.length);
-                                } catch (IOException e) {
-                                    session.exceptionCaught(e);
-                                }
-                            } else {
-                                Throwable t = future.getException();
-                                session.exceptionCaught(t);
+                    out.write(new ByteArrayBuffer(bytes)).addListener(future -> {
+                        Session session1 = channel.getSession();
+                        if (future.isWritten()) {
+                            try {
+                                Window wLocal = channel.getLocalWindow();
+                                wLocal.consumeAndCheck(bytes.length);
+                            } catch (IOException e) {
+                                session1.exceptionCaught(e);
                             }
+                        } else {
+                            Throwable t = future.getException();
+                            session1.exceptionCaught(t);
                         }
                     });
                     buffer = new StringBuilder(buffer.substring(i + 1));

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
index 7f4eaab..a0fd825 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
@@ -274,7 +274,7 @@ public abstract class BaseTestSupport extends Assert {
             return Collections.emptyList();
         }
 
-        List<Object[]> result = new ArrayList<Object[]>(params.size());
+        List<Object[]> result = new ArrayList<>(params.size());
         for (Object p : params) {
             result.add(new Object[]{p});
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/util/test/BogusPasswordAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/BogusPasswordAuthenticator.java b/sshd-core/src/test/java/org/apache/sshd/util/test/BogusPasswordAuthenticator.java
index c3a247d..252863d 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/BogusPasswordAuthenticator.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/BogusPasswordAuthenticator.java
@@ -38,7 +38,7 @@ public class BogusPasswordAuthenticator extends AbstractLoggingBean implements P
     public boolean authenticate(String username, String password, ServerSession session) {
         boolean result = (username != null) && username.equals(password);
         if (log.isDebugEnabled()) {
-            log.debug("authenticate({}) {} / {} - sucess = {}", session, username, password, Boolean.valueOf(result));
+            log.debug("authenticate({}) {} / {} - sucess = {}", session, username, password, result);
         }
 
         return result;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/util/test/JSchLogger.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/JSchLogger.java b/sshd-core/src/test/java/org/apache/sshd/util/test/JSchLogger.java
index 09124c1..bf84bff 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/JSchLogger.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/JSchLogger.java
@@ -20,7 +20,6 @@ package org.apache.sshd.util.test;
 
 import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.Logger;
-
 import org.slf4j.LoggerFactory;
 
 /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java b/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java
index d349ed1..063badb 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java
@@ -109,9 +109,9 @@ public final class Utils {
 
     public static final String DEFAULT_TEST_HOST_KEY_PROVIDER_ALGORITHM = KeyUtils.RSA_ALGORITHM;
     // uses a cached instance to avoid re-creating the keys as it is a time-consuming effort
-    private static final AtomicReference<KeyPairProvider> KEYPAIR_PROVIDER_HOLDER = new AtomicReference<KeyPairProvider>();
+    private static final AtomicReference<KeyPairProvider> KEYPAIR_PROVIDER_HOLDER = new AtomicReference<>();
     // uses a cached instance to avoid re-creating the keys as it is a time-consuming effort
-    private static final Map<String, AbstractFileKeyPairProvider> PROVIDERS_MAP = new ConcurrentHashMap<String, AbstractFileKeyPairProvider>();
+    private static final Map<String, AbstractFileKeyPairProvider> PROVIDERS_MAP = new ConcurrentHashMap<>();
 
     private Utils() {
         throw new UnsupportedOperationException("No instance");
@@ -586,10 +586,7 @@ public final class Utils {
         if (GenericUtils.isEmpty(name)) {
             return name;
         } else {
-            return new StringBuilder(name.length() + CLASS_FILE_SUFFIX.length())
-                    .append(name.replace('.', '/'))
-                    .append(CLASS_FILE_SUFFIX)
-                    .toString();
+            return name.replace('.', '/') + CLASS_FILE_SUFFIX;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java
----------------------------------------------------------------------
diff --git a/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java b/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java
index ed508d8..24f8291 100644
--- a/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java
+++ b/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java
@@ -397,7 +397,7 @@ public class LdapNetworkConnector<C> extends NetworkConnector {
 
     protected DirContext initializeDirContext(C queryContext, Map<String, Object> env, String username, String password) throws NamingException {
         Map<String, ?> ldapConfig = setupDirContextEnvironment(queryContext, env, username, password);
-        return new InitialDirContext(new Hashtable<String, Object>(ldapConfig));
+        return new InitialDirContext(new Hashtable<>(ldapConfig));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
index 0d48b61..2d0d19e 100644
--- a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
+++ b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
@@ -171,7 +171,7 @@ public abstract class BaseAuthenticatorTest extends BaseTestSupport {
             throw e;
         }
 
-        return new Pair<LdapServer, DirectoryService>(ldapServer, directoryService);
+        return new Pair<>(ldapServer, directoryService);
     }
 
     // see http://users.directory.apache.narkive.com/GkyqAkot/how-to-import-ldif-file-programmatically


[04/16] mina-sshd git commit: [SSHD-698] Remove unnecessary boxing / unboxing

Posted by gn...@apache.org.
[SSHD-698] Remove unnecessary boxing / unboxing

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/83fc8d8a
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/83fc8d8a
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/83fc8d8a

Branch: refs/heads/master
Commit: 83fc8d8a8542bc93a1c5a2adff63bee68f85e413
Parents: 57f6a6b
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Sep 15 11:24:14 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Sep 15 21:06:22 2016 +0200

----------------------------------------------------------------------
 .../org/apache/sshd/agent/common/AbstractAgentClient.java    | 4 ++--
 .../java/org/apache/sshd/agent/unix/AgentServerProxy.java    | 6 +++---
 .../client/channel/exit/ExitStatusChannelRequestHandler.java | 2 +-
 .../org/apache/sshd/client/config/hosts/HostConfigEntry.java | 6 +++---
 .../apache/sshd/client/config/hosts/HostPatternsHolder.java  | 6 +++---
 .../org/apache/sshd/client/future/DefaultAuthFuture.java     | 6 +++---
 .../org/apache/sshd/client/future/DefaultOpenFuture.java     | 4 ++--
 .../java/org/apache/sshd/client/scp/AbstractScpClient.java   | 4 ++--
 .../apache/sshd/client/session/ClientConnectionService.java  | 2 +-
 .../java/org/apache/sshd/client/session/ClientSession.java   | 2 +-
 .../apache/sshd/client/subsystem/sftp/DefaultSftpClient.java | 2 +-
 .../sshd/client/subsystem/sftp/SftpDirEntryIterator.java     | 4 ++--
 .../sshd/client/subsystem/sftp/SftpVersionSelector.java      | 2 +-
 .../java/org/apache/sshd/common/PropertyResolverUtils.java   | 6 +++---
 .../main/java/org/apache/sshd/common/channel/PtyMode.java    | 4 ++--
 .../main/java/org/apache/sshd/common/forward/SocksProxy.java | 2 +-
 .../apache/sshd/common/future/DefaultKeyExchangeFuture.java  | 2 +-
 .../src/main/java/org/apache/sshd/common/scp/ScpHelper.java  | 8 ++++----
 .../common/session/helpers/AbstractConnectionService.java    | 2 +-
 .../apache/sshd/common/session/helpers/AbstractSession.java  | 2 +-
 .../org/apache/sshd/common/subsystem/sftp/SftpHelper.java    | 6 +++---
 .../common/subsystem/sftp/extensions/AclSupportedParser.java | 6 +++---
 .../main/java/org/apache/sshd/common/util/NumberUtils.java   | 8 ++++----
 .../src/main/java/org/apache/sshd/common/util/OsUtils.java   | 4 ++--
 sshd-core/src/main/java/org/apache/sshd/server/Signal.java   | 4 ++--
 .../java/org/apache/sshd/server/channel/ChannelSession.java  | 2 +-
 .../src/main/java/org/apache/sshd/server/scp/ScpCommand.java | 2 +-
 .../apache/sshd/server/session/ServerUserAuthService.java    | 2 +-
 .../org/apache/sshd/server/subsystem/sftp/FileHandle.java    | 4 ++--
 .../org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java | 4 ++--
 .../java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java  | 2 +-
 .../org/apache/sshd/git/transport/GitSshdSessionProcess.java | 2 +-
 32 files changed, 61 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java b/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java
index 3c90403..796cbdd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentClient.java
@@ -48,7 +48,7 @@ public abstract class AbstractAgentClient extends AbstractLoggingBean {
         if (avail < 4) {
             if (log.isTraceEnabled()) {
                 log.trace("Received message total length ({}) below minuimum ({})",
-                          Integer.valueOf(avail), Integer.valueOf(4));
+                        avail, 4);
             }
             return;
         }
@@ -61,7 +61,7 @@ public abstract class AbstractAgentClient extends AbstractLoggingBean {
         if (avail < (len + 4)) {
             if (log.isTraceEnabled()) {
                 log.trace("Received request length ({}) below minuimum ({})",
-                          Integer.valueOf(avail), Integer.valueOf(len + 4));
+                        avail, len + 4);
             }
             return;
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
index e59265b..cd0f22b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
@@ -169,7 +169,7 @@ public class AgentServerProxy extends AbstractLoggingBean implements SshAgentSer
 
                     if (connectResult != Status.APR_SUCCESS) {
                         if (isDebug) {
-                            log.debug("Unable to connect to socket PIPE {}. APR errcode {}", authSocket, Long.valueOf(connectResult));
+                            log.debug("Unable to connect to socket PIPE {}. APR errcode {}", authSocket, connectResult);
                         }
                     }
 
@@ -177,7 +177,7 @@ public class AgentServerProxy extends AbstractLoggingBean implements SshAgentSer
                     int sendResult = Socket.send(tmpSocket, END_OF_STREAM_MESSAGE, 0, 1);
                     if (sendResult != 1) {
                         if (isDebug) {
-                            log.debug("Unable to send signal the EOS for {}. APR retcode {} != 1", authSocket, Integer.valueOf(sendResult));
+                            log.debug("Unable to send signal the EOS for {}. APR retcode {} != 1", authSocket, sendResult);
                         }
                     }
                 } catch (Exception e) {
@@ -190,7 +190,7 @@ public class AgentServerProxy extends AbstractLoggingBean implements SshAgentSer
 
             final int closeCode = Socket.close(handle);
             if (closeCode != Status.APR_SUCCESS) {
-                log.warn("Exceptions closing the PIPE: {}. APR error code: {} ", authSocket, Integer.valueOf(closeCode));
+                log.warn("Exceptions closing the PIPE: {}. APR error code: {} ", authSocket, closeCode);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitStatusChannelRequestHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitStatusChannelRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitStatusChannelRequestHandler.java
index 39954b1..9eb012d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitStatusChannelRequestHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitStatusChannelRequestHandler.java
@@ -50,6 +50,6 @@ public class ExitStatusChannelRequestHandler extends AbstractChannelExitRequestH
             log.debug("processRequestValue({}) status={}", channel, exitStatus);
         }
 
-        return Integer.valueOf(exitStatus);
+        return exitStatus;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
index 1a18556..4a9eda4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
@@ -249,11 +249,11 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
      * @return {@code true} if must use only the identities in this entry
      */
     public boolean isIdentitiesOnly() {
-        return (exclusiveIdentites == null) ? DEFAULT_EXCLUSIVE_IDENTITIES : exclusiveIdentites.booleanValue();
+        return (exclusiveIdentites == null) ? DEFAULT_EXCLUSIVE_IDENTITIES : exclusiveIdentites;
     }
 
     public void setIdentitiesOnly(boolean identitiesOnly) {
-        exclusiveIdentites = Boolean.valueOf(identitiesOnly);
+        exclusiveIdentites = identitiesOnly;
     }
 
     /**
@@ -560,7 +560,7 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
         appendNonEmptyProperty(sb, USER_CONFIG_PROP, getUsername());
         appendNonEmptyValues(sb, IDENTITY_FILE_CONFIG_PROP, getIdentities());
         if (exclusiveIdentites != null) {
-            appendNonEmptyProperty(sb, EXCLUSIVE_IDENTITIES_CONFIG_PROP, SshConfigFileReader.yesNoValueOf(exclusiveIdentites.booleanValue()));
+            appendNonEmptyProperty(sb, EXCLUSIVE_IDENTITIES_CONFIG_PROP, SshConfigFileReader.yesNoValueOf(exclusiveIdentites));
         }
         appendNonEmptyProperties(sb, getProperties());
         return sb;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
index 58c95a1..e9d0269 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
@@ -167,7 +167,7 @@ public abstract class HostPatternsHolder {
             /*
              * If already found a match we are interested only in negations
              */
-            if (matchFound && (!negated.booleanValue())) {
+            if (matchFound && (!negated)) {
                 continue;
             }
 
@@ -181,7 +181,7 @@ public abstract class HostPatternsHolder {
              *      If a negated entry is matched, then the Host entry is ignored,
              *      regardless of whether any other patterns on the line match.
              */
-            if (negated.booleanValue()) {
+            if (negated) {
                 return false;
             }
 
@@ -266,7 +266,7 @@ public abstract class HostPatternsHolder {
             }
         }
 
-        return new Pair<Pattern, Boolean>(Pattern.compile(sb.toString(), Pattern.CASE_INSENSITIVE), Boolean.valueOf(negated));
+        return new Pair<Pattern, Boolean>(Pattern.compile(sb.toString(), Pattern.CASE_INSENSITIVE), negated);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java
index c41bed1..60089f6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java
@@ -38,7 +38,7 @@ public class DefaultAuthFuture extends DefaultVerifiableSshFuture<AuthFuture> im
     @Override
     public AuthFuture verify(long timeoutMillis) throws IOException {
         Boolean result = verifyResult(Boolean.class, timeoutMillis);
-        if (!result.booleanValue()) {
+        if (!result) {
             throw new SshException("Authentication failed");
         }
 
@@ -58,14 +58,14 @@ public class DefaultAuthFuture extends DefaultVerifiableSshFuture<AuthFuture> im
     @Override
     public boolean isSuccess() {
         Object v = getValue();
-        return (v instanceof Boolean) && ((Boolean) v).booleanValue();
+        return (v instanceof Boolean) && (Boolean) v;
     }
 
     @Override
     public boolean isFailure() {
         Object v = getValue();
         if (v instanceof Boolean) {
-            return !((Boolean) v).booleanValue();
+            return !(Boolean) v;
         } else {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java
index 4034003..c2ee400 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java
@@ -37,7 +37,7 @@ public class DefaultOpenFuture extends DefaultVerifiableSshFuture<OpenFuture> im
     @Override
     public OpenFuture verify(long timeoutMillis) throws IOException {
         Boolean result = verifyResult(Boolean.class, timeoutMillis);
-        if (!result.booleanValue()) {
+        if (!result) {
             throw new SshException("Channel opening failed");
         }
 
@@ -57,7 +57,7 @@ public class DefaultOpenFuture extends DefaultVerifiableSshFuture<OpenFuture> im
     @Override
     public boolean isOpened() {
         Object value = getValue();
-        return (value instanceof Boolean) && ((Boolean) value).booleanValue();
+        return (value instanceof Boolean) && (Boolean) value;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
index fa979c6..9a1dc57 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
@@ -105,7 +105,7 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
                 throw new SshException("Target directory " + local.toString() + " is probaly inaccesible");
             }
 
-            if (!status.booleanValue()) {
+            if (!status) {
                 throw new SshException("Target directory " + local.toString() + " does not exist");
             }
 
@@ -220,7 +220,7 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
             return;
         }
 
-        int statusCode = exitStatus.intValue();
+        int statusCode = exitStatus;
         switch (statusCode) {
             case ScpHelper.OK:  // do nothing
                 break;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
index 6bd60ff..e55517d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
@@ -71,7 +71,7 @@ public class ClientConnectionService extends AbstractConnectionService<AbstractC
                 }
             }, interval, interval, TimeUnit.MILLISECONDS);
             if (log.isDebugEnabled()) {
-                log.debug("startHeartbeat - started at interval={}", Long.valueOf(interval));
+                log.debug("startHeartbeat - started at interval={}", interval);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
index b525032..a3c0d72 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
@@ -217,7 +217,7 @@ public interface ClientSession
             }
 
             Integer exitStatus = channel.getExitStatus();
-            if ((exitStatus != null) && (exitStatus.intValue() != 0)) {
+            if ((exitStatus != null) && (exitStatus != 0)) {
                 throw new RemoteException("Remote command failed (" + exitStatus + "): " + command, new ServerException(exitStatus.toString()));
             }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
index 8b715a1..f61d302 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
@@ -434,7 +434,7 @@ public class DefaultSftpClient extends AbstractSftpClient {
             return current;
         }
 
-        if (!available.contains(Integer.valueOf(selected))) {
+        if (!available.contains(selected)) {
             throw new StreamCorruptedException("Selected version (" + selected + ") not part of available: " + available);
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java
index e245589..564d1d9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpDirEntryIterator.java
@@ -156,7 +156,7 @@ public class SftpDirEntryIterator extends AbstractLoggingBean implements Iterato
         try {
             // check if previous call yielded an end-of-list indication
             Boolean eolReached = eolIndicator.getAndSet(null);
-            if ((eolReached != null) && eolReached.booleanValue()) {
+            if ((eolReached != null) && eolReached) {
                 if (log.isTraceEnabled()) {
                     log.trace("load({})[{}] exhausted all entries on previous call", getPath(), handle);
                 }
@@ -165,7 +165,7 @@ public class SftpDirEntryIterator extends AbstractLoggingBean implements Iterato
 
             List<DirEntry> entries = client.readDir(handle, eolIndicator);
             eolReached = eolIndicator.get();
-            if ((entries == null) || ((eolReached != null) && eolReached.booleanValue())) {
+            if ((entries == null) || ((eolReached != null) && eolReached)) {
                 if (log.isTraceEnabled()) {
                     log.trace("load({})[{}] exhausted all entries - EOL={}", getPath(), handle, eolReached);
                 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
index c5fdaf0..a8fa062 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
@@ -174,7 +174,7 @@ public interface SftpVersionSelector {
                         }
 
                         for (Integer avail : available) {
-                            if (version == avail.intValue()) {
+                            if (version == avail) {
                                 return version;
                             }
                         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java
index d5c767b..06fe537 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java
@@ -133,7 +133,7 @@ public final class PropertyResolverUtils {
         } else if (value instanceof Long) {
             return (Long) value;
         } else if (value instanceof Number) {
-            return Long.valueOf(((Number) value).longValue());
+            return ((Number) value).longValue();
         } else {    // we parse the string in case it is not a valid long value
             return Long.valueOf(value.toString());
         }
@@ -233,7 +233,7 @@ public final class PropertyResolverUtils {
         } else if (value instanceof Integer) {
             return (Integer) value;
         } else if (value instanceof Number) {
-            return Integer.valueOf(((Number) value).intValue());
+            return ((Number) value).intValue();
         } else {    // we parse the string in case this is NOT an integer
             return Integer.valueOf(value.toString());
         }
@@ -259,7 +259,7 @@ public final class PropertyResolverUtils {
         if (value == null) {
             return defaultValue;
         } else {
-            return toBoolean(value).booleanValue();
+            return toBoolean(value);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
index cae1595..82e3cbf 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
@@ -284,8 +284,8 @@ public enum PtyMode {
     public static final byte TTY_OP_END = 0x00;
 
     // objects that can be used to set {@link PtyMode}s as {@code true} or {@code false}
-    public static final Integer FALSE_SETTING = Integer.valueOf(0);
-    public static final Integer TRUE_SETTING = Integer.valueOf(1);
+    public static final Integer FALSE_SETTING = 0;
+    public static final Integer TRUE_SETTING = 1;
 
     /**
      * An un-modifiable {@link Set} of all defined {@link PtyMode}s

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
index 9ab9c10..fb581be 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
@@ -266,7 +266,7 @@ public class SocksProxy extends AbstractCloseable implements IoHandler {
                 }
                 int port = getUShort(buffer);
                 if (log.isDebugEnabled()) {
-                    log.debug("Received socks5 connection request to {}:{}", host, Integer.valueOf(port));
+                    log.debug("Received socks5 connection request to {}:{}", host, port);
                 }
                 SshdSocketAddress remote = new SshdSocketAddress(host, port);
                 channel = new TcpipClientChannel(TcpipClientChannel.Type.Direct, session, remote);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultKeyExchangeFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultKeyExchangeFuture.java b/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultKeyExchangeFuture.java
index 548a0ae..68029c5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultKeyExchangeFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultKeyExchangeFuture.java
@@ -34,7 +34,7 @@ public class DefaultKeyExchangeFuture extends DefaultVerifiableSshFuture<KeyExch
     @Override
     public KeyExchangeFuture verify(long timeoutMillis) throws IOException {
         Boolean result = verifyResult(Boolean.class, timeoutMillis);
-        if (!result.booleanValue()) {
+        if (!result) {
             throw new SshException("Key exchange failed");
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
index 1b14e2b..9aaa83e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
@@ -292,7 +292,7 @@ public class ScpHelper extends AbstractLoggingBean implements SessionHolder<Sess
             throw new AccessDeniedException("Receive directory file existence status cannot be determined: " + file);
         }
 
-        if (!(status.booleanValue() && Files.isDirectory(file, options))) {
+        if (!(status && Files.isDirectory(file, options))) {
             Files.createDirectory(file);
         }
 
@@ -664,7 +664,7 @@ public class ScpHelper extends AbstractLoggingBean implements SessionHolder<Sess
             case WARNING:
                 break;
             default:
-                throw new ScpException("Bad reply code (" + statusCode + ") for command='" + command + "' on " + location, Integer.valueOf(statusCode));
+                throw new ScpException("Bad reply code (" + statusCode + ") for command='" + command + "' on " + location, statusCode);
         }
     }
 
@@ -867,7 +867,7 @@ public class ScpHelper extends AbstractLoggingBean implements SessionHolder<Sess
             return "null";
         }
 
-        switch (exitStatus.intValue()) {
+        switch (exitStatus) {
             case OK:
                 return "OK";
             case WARNING:
@@ -917,7 +917,7 @@ public class ScpHelper extends AbstractLoggingBean implements SessionHolder<Sess
                 if (log.isDebugEnabled()) {
                     log.debug("readAck({})[EOF={}] received error: {}", this, canEof, line);
                 }
-                throw new ScpException("Received nack: " + line, Integer.valueOf(c));
+                throw new ScpException("Received nack: " + line, c);
             }
             default:
                 break;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
index 8aea3a8..0eab031 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
@@ -618,7 +618,7 @@ public abstract class AbstractConnectionService<S extends AbstractSession>
         boolean wantReply = buffer.getBoolean();
         if (log.isDebugEnabled()) {
             log.debug("globalRequest({}) received SSH_MSG_GLOBAL_REQUEST {} want-reply={}",
-                      this, req, Boolean.valueOf(wantReply));
+                      this, req, wantReply);
         }
 
         Session session = getSession();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
index 2ec5e7c..3f879e4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
@@ -528,7 +528,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
                 if ((cmd >= SshConstants.SSH_MSG_KEX_FIRST) && (cmd <= SshConstants.SSH_MSG_KEX_LAST)) {
                     if (firstKexPacketFollows != null) {
                         try {
-                            if (!handleFirstKexPacketFollows(cmd, buffer, firstKexPacketFollows.booleanValue())) {
+                            if (!handleFirstKexPacketFollows(cmd, buffer, firstKexPacketFollows)) {
                                 break;
                             }
                         } finally {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
index 3e0aa2a..0333fd1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
@@ -91,7 +91,7 @@ public final class SftpHelper {
      * @see <A HREF="https://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.3">SFTP v6 - section 9.3</A>
      */
     public static Boolean getEndOfFileIndicatorValue(Buffer buffer, int version) {
-        return (version <  SftpConstants.SFTP_V6) || (buffer.available() < 1) ? null : Boolean.valueOf(buffer.getBoolean());
+        return (version <  SftpConstants.SFTP_V6) || (buffer.available() < 1) ? null : buffer.getBoolean();
     }
 
     /**
@@ -105,7 +105,7 @@ public final class SftpHelper {
      * @see #indicateEndOfNamesList(Buffer, int, PropertyResolver, Boolean)
      */
     public static Boolean getEndOfListIndicatorValue(Buffer buffer, int version) {
-        return (version <  SftpConstants.SFTP_V6) || (buffer.available() < 1) ? null : Boolean.valueOf(buffer.getBoolean());
+        return (version <  SftpConstants.SFTP_V6) || (buffer.available() < 1) ? null : buffer.getBoolean();
     }
 
     /**
@@ -144,7 +144,7 @@ public final class SftpHelper {
             return null;
         }
 
-        buffer.putBoolean(indicatorValue.booleanValue());
+        buffer.putBoolean(indicatorValue);
         return indicatorValue;
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
index f218510..e9ccf97 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
@@ -155,7 +155,7 @@ public class AclSupportedParser extends AbstractParser<AclCapabilities> {
             for (Map.Entry<Integer, String> ae : map.entrySet()) {
                 Integer value = ae.getKey();
                 String name = ae.getValue();
-                if ((mask & value.intValue()) != 0) {
+                if ((mask & value) != 0) {
                     caps.add(name);
                 }
             }
@@ -170,7 +170,7 @@ public class AclSupportedParser extends AbstractParser<AclCapabilities> {
 
             int mask = 0;
             for (Integer v : maskValues) {
-                mask |= v.intValue();
+                mask |= v;
             }
 
             return mask;
@@ -184,7 +184,7 @@ public class AclSupportedParser extends AbstractParser<AclCapabilities> {
             Map<Integer, String> map = getAclCapabilityValuesMap();
             Set<Integer> caps = new HashSet<Integer>(map.size());
             for (Integer v : map.keySet()) {
-                if ((mask & v.intValue()) != 0) {
+                if ((mask & v) != 0) {
                     caps.add(v);
                 }
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
index e988f8a..51c321b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
@@ -49,7 +49,7 @@ public final class NumberUtils {
                 {
                     long value = 1L;
                     for (int power = 0; power < Long.SIZE; power++, value <<= 1) {
-                        add(Long.valueOf(value));
+                        add(value);
                     }
                 }
             });
@@ -60,7 +60,7 @@ public final class NumberUtils {
 
     public static boolean isPowerOf2(long value) {
         for (Long l : POWERS_OF_TWO) {
-            if (value == l.longValue()) {
+            if (value == l) {
                 return true;
             }
         }
@@ -140,7 +140,7 @@ public final class NumberUtils {
         } else if (n instanceof Integer) {
             return (Integer) n;
         } else {
-            return Integer.valueOf(n.intValue());
+            return n.intValue();
         }
     }
 
@@ -272,7 +272,7 @@ public final class NumberUtils {
 
         List<Integer> l = new ArrayList<>(len);
         for (int v : values) {
-            l.add(Integer.valueOf(v));
+            l.add(v);
         }
 
         return l;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java
index 9edd772..f0b2c7e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java
@@ -83,7 +83,7 @@ public final class OsUtils {
         synchronized (OS_TYPE_HOLDER) {
             typeValue = OS_TYPE_HOLDER.get();
             if (typeValue != null) {    // is it the 1st time
-                return typeValue.booleanValue();
+                return typeValue;
             }
 
             String value = System.getProperty(OS_TYPE_OVERRIDE_PROP, System.getProperty("os.name"));
@@ -91,7 +91,7 @@ public final class OsUtils {
             OS_TYPE_HOLDER.set(typeValue);
         }
 
-        return typeValue.booleanValue();
+        return typeValue;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/Signal.java b/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
index 3d88580..ad4917e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
@@ -96,7 +96,7 @@ public enum Signal {
 
                 {
                     for (Signal s : SIGNALS) {
-                        put(Integer.valueOf(s.getNumeric()), s);
+                        put(s.getNumeric(), s);
                     }
                 }
             });
@@ -132,6 +132,6 @@ public enum Signal {
      * @see #getNumeric()
      */
     public static Signal get(int num) {
-        return NUMERIC_LOOKUP_TABLE.get(Integer.valueOf(num));
+        return NUMERIC_LOOKUP_TABLE.get(num);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
index a0ede0f..b09f1f7 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
@@ -172,7 +172,7 @@ public class ChannelSession extends AbstractServerChannel {
                 long timeout = PropertyResolverUtils.getLongProperty(
                         channel, ServerFactoryManager.COMMAND_EXIT_TIMEOUT, ServerFactoryManager.DEFAULT_COMMAND_EXIT_TIMEOUT);
                 if (log.isDebugEnabled()) {
-                    log.debug("Wait {} ms for shell to exit cleanly on {}", Long.valueOf(timeout), channel);
+                    log.debug("Wait {} ms for shell to exit cleanly on {}", timeout, channel);
                 }
 
                 Session s = channel.getSession();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommand.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommand.java b/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommand.java
index dfa0f60..e59a331 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommand.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommand.java
@@ -285,7 +285,7 @@ public class ScpCommand
                 if (e instanceof ScpException) {
                     statusCode = ((ScpException) e).getExitStatus();
                 }
-                exitValue = (statusCode == null) ? ScpHelper.ERROR : statusCode.intValue();
+                exitValue = (statusCode == null) ? ScpHelper.ERROR : statusCode;
                 // this is an exception so status cannot be OK/WARNING
                 if ((exitValue == ScpHelper.OK) || (exitValue == ScpHelper.WARNING)) {
                     if (log.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
index e31af32..22040fc 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
@@ -239,7 +239,7 @@ public class ServerUserAuthService extends AbstractCloseable implements Service,
 
         if (authed == null) {
             handleAuthenticationInProgress(cmd, buffer);
-        } else if (authed.booleanValue()) {
+        } else if (authed) {
             handleAuthenticationSuccess(cmd, buffer);
         } else {
             handleAuthenticationFailure(cmd, buffer);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java
index 9299151..f6f1e8e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/FileHandle.java
@@ -209,12 +209,12 @@ public class FileHandle extends Handle {
     public static FileAttribute<?> toFileAttribute(final String key, final Object val) {
         // Some ignored attributes sent by the SFTP client
         if ("isOther".equals(key)) {
-            if (((Boolean) val).booleanValue()) {
+            if ((Boolean) val) {
                 throw new IllegalArgumentException("Not allowed to use " + key + "=" + val);
             }
             return null;
         } else if ("isRegular".equals(key)) {
-            if (!((Boolean) val).booleanValue()) {
+            if (!(Boolean) val) {
                 throw new IllegalArgumentException("Not allowed to use " + key + "=" + val);
             }
             return null;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
index 71d4379..8144252 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
@@ -1849,7 +1849,7 @@ public class SftpSubsystem
                     dh.markDone();
                 }
 
-                Boolean indicator = SftpHelper.indicateEndOfNamesList(reply, getVersion(), session, Boolean.valueOf(dh.isDone()));
+                Boolean indicator = SftpHelper.indicateEndOfNamesList(reply, getVersion(), session, dh.isDone());
                 if (log.isDebugEnabled()) {
                     log.debug("doReadDir({})({})[{}] - seding {} entries - eol={}", session, handle, h, count, indicator);
                 }
@@ -2246,7 +2246,7 @@ public class SftpSubsystem
             if (handles.containsKey(handle)) {
                 if (log.isTraceEnabled()) {
                     log.trace("generateFileHandle({})[{}] handle={} in use at round {}",
-                              getServerSession(), file, handle, Integer.valueOf(index));
+                              getServerSession(), file, handle, index);
                 }
                 continue;
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java b/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java
index 04cb8d3..dfcc6ab 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java
@@ -154,7 +154,7 @@ public class EmbeddedCommandRunner {
         set(cmd, "errs", err);
         
         Boolean success = (Boolean) call(cmd, "requiresRepository"); 
-        if (success.booleanValue()) {
+        if (success) {
             call(cmd, "init", new Class[] {Repository.class, String.class}, new Object[] {openGitDir(gitdir), gitdir});
         } else {
             call(cmd, "init", new Class[] {Repository.class, String.class}, new Object[] {null, gitdir});

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fc8d8a/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionProcess.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionProcess.java b/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionProcess.java
index 576712c..3e4ae13 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionProcess.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionProcess.java
@@ -87,7 +87,7 @@ public class GitSshdSessionProcess extends Process {
             log.trace("exitValue({}) channel={}, timeout={} millis.: {}",
                       commandName, channel, waitTimeout, status);
         }
-        return status.intValue();
+        return status;
     }
 
     @Override


[15/16] mina-sshd git commit: [SSHD-698] Use lambda and method references, streams Deprecate Utils inner classes and use interface methods instead.

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
index 24c9983..a83dfeb 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
@@ -91,15 +91,11 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
         this.type = ValidateUtils.checkNotNullAndNotEmpty(type, "No channel type specified");
         this.streaming = Streaming.Sync;
 
-        addChannelSignalRequestHandlers(new EventNotifier<String>() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public void notifyEvent(String event) throws Exception {
-                if (log.isDebugEnabled()) {
-                    log.debug("notifyEvent({}): {}", AbstractClientChannel.this, event);
-                }
-                notifyStateChanged(event);
+        addChannelSignalRequestHandlers(event -> {
+            if (log.isDebugEnabled()) {
+                log.debug("notifyEvent({}): {}", AbstractClientChannel.this, event);
             }
+            notifyStateChanged(event);
         });
     }
 
@@ -179,24 +175,20 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
     protected Closeable getInnerCloseable() {
         return builder()
                 .when(openFuture)
-                .run(new Runnable() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public void run() {
-                        // If the channel has not been opened yet,
-                        // skip the SSH_MSG_CHANNEL_CLOSE exchange
-                        if (openFuture == null) {
-                            gracefulFuture.setClosed();
-                        }
-                        // Close inverted streams after
-                        // If the inverted stream is closed before, there's a small time window
-                        // in which we have:
-                        //    ChannelPipedInputStream#closed = true
-                        //    ChannelPipedInputStream#writerClosed = false
-                        // which leads to an IOException("Pipe closed") when reading.
-                        IoUtils.closeQuietly(in, out, err);
-                        IoUtils.closeQuietly(invertedIn, invertedOut, invertedErr);
+                .run(() -> {
+                    // If the channel has not been opened yet,
+                    // skip the SSH_MSG_CHANNEL_CLOSE exchange
+                    if (openFuture == null) {
+                        gracefulFuture.setClosed();
                     }
+                    // Close inverted streams after
+                    // If the inverted stream is closed before, there's a small time window
+                    // in which we have:
+                    //    ChannelPipedInputStream#closed = true
+                    //    ChannelPipedInputStream#writerClosed = false
+                    // which leads to an IOException("Pipe closed") when reading.
+                    IoUtils.closeQuietly(in, out, err);
+                    IoUtils.closeQuietly(invertedIn, invertedOut, invertedErr);
                 })
                 .parallel(asyncIn, asyncOut, asyncErr)
                 .close(new GracefulChannelCloseable())

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
index e59f7b3..e76aab4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
@@ -101,12 +101,7 @@ public class ChannelSession extends AbstractClientChannel {
                 // Interrupt does not really work and the thread will only exit when
                 // the call to read() will return.  So ensure this thread is a daemon
                 // to avoid blocking the whole app
-                pumper = pumperService.submit(new Runnable() {
-                    @Override
-                    public void run() {
-                        pumpInputStream();
-                    }
-                });
+                pumper = pumperService.submit(this::pumpInputStream);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java
index 2f9119b..132e756 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java
@@ -24,8 +24,6 @@ import java.util.Date;
 import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.channel.Channel;
-import org.apache.sshd.common.future.CloseFuture;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
@@ -112,12 +110,7 @@ public class ChannelSubsystem extends ChannelSession {
     }
 
     public void onClose(final Runnable run) {
-        closeFuture.addListener(new SshFutureListener<CloseFuture>() {
-            @Override
-            public void operationComplete(CloseFuture future) {
-                run.run();
-            }
-        });
+        closeFuture.addListener(future -> run.run());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java
index 08750a3..669ae0d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java
@@ -79,19 +79,15 @@ public class PtyCapableChannelSession extends ChannelSession {
     public static final int DEFAULT_WIDTH = 640;
     public static final int DEFAULT_HEIGHT = 480;
     public static final Map<PtyMode, Integer> DEFAULT_PTY_MODES =
-            Collections.unmodifiableMap(new EnumMap<PtyMode, Integer>(PtyMode.class) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    put(PtyMode.ISIG, 1);
-                    put(PtyMode.ICANON, 1);
-                    put(PtyMode.ECHO, 1);
-                    put(PtyMode.ECHOE, 1);
-                    put(PtyMode.ECHOK, 1);
-                    put(PtyMode.ECHONL, 0);
-                    put(PtyMode.NOFLSH, 0);
-                }
-            });
+            GenericUtils.<PtyMode, Integer>mapBuilder()
+                .put(PtyMode.ISIG, 1)
+                .put(PtyMode.ICANON, 1)
+                .put(PtyMode.ECHO, 1)
+                .put(PtyMode.ECHOE, 1)
+                .put(PtyMode.ECHOK, 1)
+                .put(PtyMode.ECHONL, 0)
+                .put(PtyMode.NOFLSH, 0)
+                .immutable();
 
     private boolean agentForwarding;
     private boolean usePty;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
index 20e1f40..d8c08a6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
@@ -504,9 +504,7 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
             return setProperty(key, value);
         }
 
-        StringBuilder sb = new StringBuilder(curVal.length() + value.length() + 1);
-        sb.append(curVal).append(',').append(value);
-        return setProperty(key, sb.toString());
+        return setProperty(key, curVal + ',' + value);
     }
 
     /**
@@ -671,22 +669,19 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
         if (GenericUtils.isEmpty(entries)) {
             return HostConfigEntryResolver.EMPTY;
         } else {
-            return new HostConfigEntryResolver() {
-                @Override
-                public HostConfigEntry resolveEffectiveHost(String host, int port, String username) throws IOException {
-                    List<HostConfigEntry> matches = findMatchingEntries(host, entries);
-                    int numMatches = GenericUtils.size(matches);
-                    if (numMatches <= 0) {
-                        return null;
-                    }
-
-                    HostConfigEntry match = (numMatches == 1) ? matches.get(0) : findBestMatch(matches);
-                    if (match == null) {
-                        ValidateUtils.throwIllegalArgumentException("No best match found for %s@%s:%d out of %d matches", username, host, port, numMatches);
-                    }
+            return (host1, port1, username1) -> {
+                List<HostConfigEntry> matches = findMatchingEntries(host1, entries);
+                int numMatches = GenericUtils.size(matches);
+                if (numMatches <= 0) {
+                    return null;
+                }
 
-                    return normalizeEntry(match, host, port, username);
+                HostConfigEntry match = (numMatches == 1) ? matches.get(0) : findBestMatch(matches);
+                if (match == null) {
+                    ValidateUtils.throwIllegalArgumentException("No best match found for %s@%s:%d out of %d matches", username1, host1, port1, numMatches);
                 }
+
+                return normalizeEntry(match, host1, port1, username1);
             };
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostDigest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostDigest.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostDigest.java
index 3005f47..1710194 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostDigest.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/KnownHostDigest.java
@@ -60,6 +60,6 @@ public enum KnownHostDigest implements NamedFactory<Mac> {
     }
 
     public static KnownHostDigest fromName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/config/keys/BuiltinClientIdentitiesWatcher.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/BuiltinClientIdentitiesWatcher.java b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/BuiltinClientIdentitiesWatcher.java
index fb9abce..29aee8d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/BuiltinClientIdentitiesWatcher.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/BuiltinClientIdentitiesWatcher.java
@@ -43,7 +43,7 @@ public class BuiltinClientIdentitiesWatcher extends ClientIdentitiesWatcher {
 
     public BuiltinClientIdentitiesWatcher(Path keysFolder, boolean supportedOnly,
             ClientIdentityLoader loader, FilePasswordProvider provider, boolean strict) {
-        this(keysFolder, NamedResource.Utils.getNameList(BuiltinIdentities.VALUES), supportedOnly, loader, provider, strict);
+        this(keysFolder, NamedResource.getNameList(BuiltinIdentities.VALUES), supportedOnly, loader, provider, strict);
     }
 
     public BuiltinClientIdentitiesWatcher(Path keysFolder, Collection<String> ids, boolean supportedOnly,
@@ -56,7 +56,7 @@ public class BuiltinClientIdentitiesWatcher extends ClientIdentitiesWatcher {
 
     public BuiltinClientIdentitiesWatcher(Path keysFolder, boolean supportedOnly,
             Supplier<ClientIdentityLoader> loader, Supplier<FilePasswordProvider> provider, boolean strict) {
-        this(keysFolder, NamedResource.Utils.getNameList(BuiltinIdentities.VALUES), supportedOnly, loader, provider, strict);
+        this(keysFolder, NamedResource.getNameList(BuiltinIdentities.VALUES), supportedOnly, loader, provider, strict);
     }
 
     public BuiltinClientIdentitiesWatcher(Path keysFolder, Collection<String> ids, boolean supportedOnly,
@@ -94,19 +94,13 @@ public class BuiltinClientIdentitiesWatcher extends ClientIdentitiesWatcher {
             toRemove.add(kp);
         }
 
-        if (GenericUtils.isEmpty(toRemove)) {
-            return keys;
-        }
-
-        for (KeyPair kp : toRemove) {
-            keys.remove(kp);
-        }
+        GenericUtils.forEach(toRemove, keys::remove);
 
         return keys;
     }
 
     public static List<Path> getDefaultBuiltinIdentitiesPaths(Path keysFolder) {
-        return getBuiltinIdentitiesPaths(keysFolder, NamedResource.Utils.getNameList(BuiltinIdentities.VALUES));
+        return getBuiltinIdentitiesPaths(keysFolder, NamedResource.getNameList(BuiltinIdentities.VALUES));
     }
 
     public static List<Path> getBuiltinIdentitiesPaths(Path keysFolder, Collection<String> ids) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java
index c3dfe01..3c90060 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java
@@ -111,11 +111,6 @@ public class ClientIdentitiesWatcher extends AbstractKeyPairProvider implements
             return Collections.emptyList();
         }
 
-        List<ClientIdentityProvider> providers = new ArrayList<>(paths.size());
-        for (Path p : paths) {
-            providers.add(new ClientIdentityFileWatcher(p, loader, provider, strict));
-        }
-
-        return providers;
+        return GenericUtils.map(paths, p -> new ClientIdentityFileWatcher(p, loader, provider, strict));
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java
index e3e7b3c..7554b8d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java
@@ -56,12 +56,7 @@ public final class ClientIdentity {
     public static final String ID_FILE_SUFFIX = "";
 
     public static final Transformer<String, String> ID_GENERATOR =
-        new Transformer<String, String>() {
-            @Override
-            public String transform(String input) {
-                return getIdentityFileName(input);
-            }
-        };
+            ClientIdentity::getIdentityFileName;
 
     private ClientIdentity() {
         throw new UnsupportedOperationException("No instance");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java b/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java
index dc736f9..1641095 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java
@@ -54,7 +54,7 @@ public class DHGClient extends AbstractDHClientKeyExchange {
         return factory.getName();
     }
 
-    public static final KeyExchangeFactory newFactory(final DHFactory delegate) {
+    public static KeyExchangeFactory newFactory(final DHFactory delegate) {
         return new KeyExchangeFactory() {
             @Override
             public String getName() {
@@ -100,11 +100,11 @@ public class DHGClient extends AbstractDHClientKeyExchange {
     public boolean next(int cmd, Buffer buffer) throws Exception {
         Session session = getSession();
         if (log.isDebugEnabled()) {
-            log.debug("next({})[{}] process command={}", this, session, KeyExchange.Utils.getSimpleKexOpcodeName(cmd));
+            log.debug("next({})[{}] process command={}", this, session, KeyExchange.getSimpleKexOpcodeName(cmd));
         }
         if (cmd != SshConstants.SSH_MSG_KEXDH_REPLY) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_KEY_EXCHANGE_FAILED,
-                    "Protocol error: expected packet SSH_MSG_KEXDH_REPLY, got " + KeyExchange.Utils.getSimpleKexOpcodeName(cmd));
+                    "Protocol error: expected packet SSH_MSG_KEXDH_REPLY, got " + KeyExchange.getSimpleKexOpcodeName(cmd));
         }
 
         byte[] k_s = buffer.getBytes();
@@ -132,7 +132,7 @@ public class DHGClient extends AbstractDHClientKeyExchange {
         hash.update(buffer.array(), 0, buffer.available());
         h = hash.digest();
 
-        Signature verif = ValidateUtils.checkNotNull(NamedFactory.Utils.create(session.getSignatureFactories(), keyAlg),
+        Signature verif = ValidateUtils.checkNotNull(NamedFactory.create(session.getSignatureFactories(), keyAlg),
                 "No verifier located for algorithm=%s",
                 keyAlg);
         verif.initVerifier(serverKey);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java b/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java
index 644ab48..16bfcbe 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java
@@ -103,13 +103,13 @@ public class DHGEXClient extends AbstractDHClientKeyExchange {
     public boolean next(int cmd, Buffer buffer) throws Exception {
         Session session = getSession();
         if (log.isDebugEnabled()) {
-            log.debug("next({})[{}] process command={}", this, session, KeyExchange.Utils.getGroupKexOpcodeName(cmd));
+            log.debug("next({})[{}] process command={}", this, session, KeyExchange.getGroupKexOpcodeName(cmd));
         }
 
         if (cmd != expected) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_KEY_EXCHANGE_FAILED,
-                    "Protocol error: expected packet " + KeyExchange.Utils.getGroupKexOpcodeName(expected)
-                  + ", got " + KeyExchange.Utils.getGroupKexOpcodeName(cmd));
+                    "Protocol error: expected packet " + KeyExchange.getGroupKexOpcodeName(expected)
+                  + ", got " + KeyExchange.getGroupKexOpcodeName(cmd));
         }
 
         if (cmd == SshConstants.SSH_MSG_KEX_DH_GEX_GROUP) {
@@ -163,7 +163,7 @@ public class DHGEXClient extends AbstractDHClientKeyExchange {
             h = hash.digest();
 
             Signature verif = ValidateUtils.checkNotNull(
-                    NamedFactory.Utils.create(session.getSignatureFactories(), keyAlg),
+                    NamedFactory.create(session.getSignatureFactories(), keyAlg),
                     "No verifier located for algorithm=%s",
                     keyAlg);
             verif.initVerifier(serverKey);
@@ -175,7 +175,7 @@ public class DHGEXClient extends AbstractDHClientKeyExchange {
             return true;
         }
 
-        throw new IllegalStateException("Unknown command value: " + KeyExchange.Utils.getGroupKexOpcodeName(cmd));
+        throw new IllegalStateException("Unknown command value: " + KeyExchange.getGroupKexOpcodeName(cmd));
     }
 
     protected AbstractDH getDH(BigInteger p, BigInteger g) throws Exception {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
index f798de5..233abf1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
@@ -144,23 +144,21 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
     @Override
     public void upload(String[] local, String remote, Collection<Option> options) throws IOException {
         final Collection<String> paths = Arrays.asList(ValidateUtils.checkNotNullAndNotEmpty(local, "Invalid argument local: %s", (Object) local));
-        runUpload(remote, options, paths, new ScpOperationExecutor<String>() {
-            @Override
-            public void execute(ScpHelper helper, Collection<String> local, Collection<Option> sendOptions) throws IOException {
-                helper.send(local, sendOptions.contains(Option.Recursive), sendOptions.contains(Option.PreserveAttributes), ScpHelper.DEFAULT_SEND_BUFFER_SIZE);
-            }
-        });
+        runUpload(remote, options, paths, (helper, local1, sendOptions) ->
+                helper.send(local1,
+                            sendOptions.contains(Option.Recursive),
+                            sendOptions.contains(Option.PreserveAttributes),
+                            ScpHelper.DEFAULT_SEND_BUFFER_SIZE));
     }
 
     @Override
     public void upload(Path[] local, String remote, Collection<Option> options) throws IOException {
         final Collection<Path> paths = Arrays.asList(ValidateUtils.checkNotNullAndNotEmpty(local, "Invalid argument local: %s", (Object) local));
-        runUpload(remote, options, paths, new ScpOperationExecutor<Path>() {
-            @Override
-            public void execute(ScpHelper helper, Collection<Path> local, Collection<Option> sendOptions) throws IOException {
-                helper.sendPaths(local, sendOptions.contains(Option.Recursive), sendOptions.contains(Option.PreserveAttributes), ScpHelper.DEFAULT_SEND_BUFFER_SIZE);
-            }
-        });
+        runUpload(remote, options, paths, (helper, local1, sendOptions) ->
+                helper.sendPaths(local1,
+                                 sendOptions.contains(Option.Recursive),
+                                 sendOptions.contains(Option.PreserveAttributes),
+                                 ScpHelper.DEFAULT_SEND_BUFFER_SIZE));
     }
 
     protected abstract <T> void runUpload(String remote, Collection<Option> options, Collection<T> local, AbstractScpClient.ScpOperationExecutor<T> executor) throws IOException;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java b/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
index b7453f8..9894bfd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
@@ -93,7 +93,7 @@ public abstract class AbstractClientSession extends AbstractSession implements C
 
     protected AbstractClientSession(ClientFactoryManager factoryManager, IoSession ioSession) {
         super(false, factoryManager, ioSession);
-        identitiesProvider = AuthenticationIdentitiesProvider.Utils.wrap(identities);
+        identitiesProvider = AuthenticationIdentitiesProvider.wrap(identities);
     }
 
     @Override
@@ -179,8 +179,8 @@ public abstract class AbstractClientSession extends AbstractSession implements C
             return null;
         }
 
-        int index = AuthenticationIdentitiesProvider.Utils.findIdentityIndex(
-                identities, AuthenticationIdentitiesProvider.Utils.PASSWORD_IDENTITY_COMPARATOR, password);
+        int index = AuthenticationIdentitiesProvider.findIdentityIndex(
+                identities, AuthenticationIdentitiesProvider.PASSWORD_IDENTITY_COMPARATOR, password);
         if (index >= 0) {
             return (String) identities.remove(index);
         } else {
@@ -209,8 +209,8 @@ public abstract class AbstractClientSession extends AbstractSession implements C
             return null;
         }
 
-        int index = AuthenticationIdentitiesProvider.Utils.findIdentityIndex(
-                identities, AuthenticationIdentitiesProvider.Utils.KEYPAIR_IDENTITY_COMPARATOR, kp);
+        int index = AuthenticationIdentitiesProvider.findIdentityIndex(
+                identities, AuthenticationIdentitiesProvider.KEYPAIR_IDENTITY_COMPARATOR, kp);
         if (index >= 0) {
             return (KeyPair) identities.remove(index);
         } else {
@@ -355,7 +355,7 @@ public abstract class AbstractClientSession extends AbstractSession implements C
 
     @Override
     public FileSystem createSftpFileSystem(int version) throws IOException {
-        return createSftpFileSystem(SftpVersionSelector.Utils.fixedVersionSelector(version));
+        return createSftpFileSystem(SftpVersionSelector.fixedVersionSelector(version));
     }
 
     @Override
@@ -365,7 +365,7 @@ public abstract class AbstractClientSession extends AbstractSession implements C
 
     @Override
     public FileSystem createSftpFileSystem(int version, int readBufferSize, int writeBufferSize) throws IOException {
-        return createSftpFileSystem(SftpVersionSelector.Utils.fixedVersionSelector(version), readBufferSize, writeBufferSize);
+        return createSftpFileSystem(SftpVersionSelector.fixedVersionSelector(version), readBufferSize, writeBufferSize);
     }
 
     @Override
@@ -421,7 +421,7 @@ public abstract class AbstractClientSession extends AbstractSession implements C
     protected String resolveAvailableSignaturesProposal(FactoryManager manager) {
         // the client does not have to provide keys for the available signatures
         ValidateUtils.checkTrue(manager == getFactoryManager(), "Mismatched factory manager instances");
-        return NamedResource.Utils.getNames(getSignatureFactories());
+        return NamedResource.getNames(getSignatureFactories());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
index e55517d..1377e99 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
@@ -64,12 +64,7 @@ public class ClientConnectionService extends AbstractConnectionService<AbstractC
         if (interval > 0L) {
             FactoryManager manager = session.getFactoryManager();
             ScheduledExecutorService service = manager.getScheduledExecutorService();
-            service.scheduleAtFixedRate(new Runnable() {
-                @Override
-                public void run() {
-                    sendHeartBeat();
-                }
-            }, interval, interval, TimeUnit.MILLISECONDS);
+            service.scheduleAtFixedRate(this::sendHeartBeat, interval, interval, TimeUnit.MILLISECONDS);
             if (log.isDebugEnabled()) {
                 log.debug("startHeartbeat - started at interval={}", interval);
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
index aac8d57..e9a019a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
@@ -88,7 +88,7 @@ public class ClientUserAuthService
             }
 
             for (String pref : GenericUtils.split(prefs, ',')) {
-                NamedFactory<UserAuth> factory = NamedResource.Utils.findByName(pref, String.CASE_INSENSITIVE_ORDER, authFactories);
+                NamedFactory<UserAuth> factory = NamedResource.findByName(pref, String.CASE_INSENSITIVE_ORDER, authFactories);
                 if (factory != null) {
                     clientMethods.add(pref);
                 } else {
@@ -318,7 +318,7 @@ public class ClientUserAuthService
                 return;
             }
 
-            userAuth = NamedFactory.Utils.create(authFactories, method);
+            userAuth = NamedFactory.create(authFactories, method);
             if (userAuth == null) {
                 throw new UnsupportedOperationException("Failed to find a user-auth factory for method=" + method);
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java b/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java
index 4a65e5c..90007c5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java
@@ -20,8 +20,6 @@
 package org.apache.sshd.client.simple;
 
 import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
@@ -45,46 +43,6 @@ public abstract class AbstractSimpleClient extends AbstractLoggingBean implement
     }
 
     @Override
-    public SftpClient sftpLogin(String host, String username, String password) throws IOException {
-        return sftpLogin(host, DEFAULT_PORT, username, password);
-    }
-
-    @Override
-    public SftpClient sftpLogin(String host, int port, String username, String password) throws IOException {
-        return sftpLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No host")), port, username, password);
-    }
-
-    @Override
-    public SftpClient sftpLogin(String host, String username, KeyPair identity) throws IOException {
-        return sftpLogin(host, DEFAULT_PORT, username, identity);
-    }
-
-    @Override
-    public SftpClient sftpLogin(String host, int port, String username, KeyPair identity) throws IOException {
-        return sftpLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No host")), port, username, identity);
-    }
-
-    @Override
-    public SftpClient sftpLogin(InetAddress host, String username, String password) throws IOException {
-        return sftpLogin(host, DEFAULT_PORT, username, password);
-    }
-
-    @Override
-    public SftpClient sftpLogin(InetAddress host, int port, String username, String password) throws IOException {
-        return sftpLogin(new InetSocketAddress(ValidateUtils.checkNotNull(host, "No host address"), port), username, password);
-    }
-
-    @Override
-    public SftpClient sftpLogin(InetAddress host, String username, KeyPair identity) throws IOException {
-        return sftpLogin(host, DEFAULT_PORT, username, identity);
-    }
-
-    @Override
-    public SftpClient sftpLogin(InetAddress host, int port, String username, KeyPair identity) throws IOException {
-        return sftpLogin(new InetSocketAddress(ValidateUtils.checkNotNull(host, "No host address"), port), username, identity);
-    }
-
-    @Override
     public SftpClient sftpLogin(SocketAddress target, String username, String password) throws IOException {
         return createSftpClient(sessionLogin(target, username, password));
     }
@@ -148,42 +106,38 @@ public abstract class AbstractSimpleClient extends AbstractLoggingBean implement
     protected SftpClient createSftpClient(final ClientSession session, final SftpClient client) throws IOException {
         ClassLoader loader = getClass().getClassLoader();
         Class<?>[] interfaces = {SftpClient.class};
-        return (SftpClient) Proxy.newProxyInstance(loader, interfaces, new InvocationHandler() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-                Throwable err = null;
-                Object result = null;
-                String name = method.getName();
+        return (SftpClient) Proxy.newProxyInstance(loader, interfaces, (proxy, method, args) -> {
+            Throwable err = null;
+            Object result = null;
+            String name = method.getName();
+            try {
+                result = method.invoke(client, args);
+            } catch (Throwable t) {
+                if (log.isTraceEnabled()) {
+                    log.trace("invoke(SftpClient#{}) failed ({}) to execute: {}",
+                              name, t.getClass().getSimpleName(), t.getMessage());
+                }
+                err = GenericUtils.accumulateException(err, t);
+            }
+
+            // propagate the "close" call to the session as well
+            if ("close".equals(name) && GenericUtils.isEmpty(args)) {
                 try {
-                    result = method.invoke(client, args);
+                    session.close();
                 } catch (Throwable t) {
-                    if (log.isTraceEnabled()) {
-                        log.trace("invoke(SftpClient#{}) failed ({}) to execute: {}",
+                    if (log.isDebugEnabled()) {
+                        log.debug("invoke(ClientSession#{}) failed ({}) to execute: {}",
                                   name, t.getClass().getSimpleName(), t.getMessage());
                     }
                     err = GenericUtils.accumulateException(err, t);
                 }
+            }
 
-                // propagate the "close" call to the session as well
-                if ("close".equals(name) && GenericUtils.isEmpty(args)) {
-                    try {
-                        session.close();
-                    } catch (Throwable t) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("invoke(ClientSession#{}) failed ({}) to execute: {}",
-                                      name, t.getClass().getSimpleName(), t.getMessage());
-                        }
-                        err = GenericUtils.accumulateException(err, t);
-                    }
-                }
-
-                if (err != null) {
-                    throw err;
-                }
-
-                return result;
+            if (err != null) {
+                throw err;
             }
+
+            return result;
         });
     }
     @Override
@@ -241,25 +195,21 @@ public abstract class AbstractSimpleClient extends AbstractLoggingBean implement
             final ScpClient client = ValidateUtils.checkNotNull(session, "No client session").createScpClient();
             ClassLoader loader = getClass().getClassLoader();
             Class<?>[] interfaces = {CloseableScpClient.class};
-            return (CloseableScpClient) Proxy.newProxyInstance(loader, interfaces, new InvocationHandler() {
-                @SuppressWarnings("synthetic-access")
-                @Override
-                public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-                    String name = method.getName();
-                    try {
-                        // The Channel implementation is provided by the session
-                        if (("close".equals(name) || "isOpen".equals(name)) && GenericUtils.isEmpty(args)) {
-                            return method.invoke(session, args);
-                        } else {
-                            return method.invoke(client, args);
-                        }
-                    } catch (Throwable t) {
-                        if (log.isTraceEnabled()) {
-                            log.trace("invoke(CloseableScpClient#{}) failed ({}) to execute: {}",
-                                      name, t.getClass().getSimpleName(), t.getMessage());
-                        }
-                        throw t;
+            return (CloseableScpClient) Proxy.newProxyInstance(loader, interfaces, (proxy, method, args) -> {
+                String name = method.getName();
+                try {
+                    // The Channel implementation is provided by the session
+                    if (("close".equals(name) || "isOpen".equals(name)) && GenericUtils.isEmpty(args)) {
+                        return method.invoke(session, args);
+                    } else {
+                        return method.invoke(client, args);
+                    }
+                } catch (Throwable t) {
+                    if (log.isTraceEnabled()) {
+                        log.trace("invoke(CloseableScpClient#{}) failed ({}) to execute: {}",
+                                  name, t.getClass().getSimpleName(), t.getMessage());
                     }
+                    throw t;
                 }
             });
         } catch (Exception e) {
@@ -287,43 +237,4 @@ public abstract class AbstractSimpleClient extends AbstractLoggingBean implement
         }
     }
 
-    @Override   // TODO make this a default method in Java-8
-    public ClientSession sessionLogin(String host, String username, String password) throws IOException {
-        return sessionLogin(host, DEFAULT_PORT, username, password);
-    }
-
-    @Override   // TODO make this a default method in Java-8
-    public ClientSession sessionLogin(String host, String username, KeyPair identity) throws IOException {
-        return sessionLogin(host, DEFAULT_PORT, username, identity);
-    }
-
-    @Override   // TODO make this a default method in Java-8
-    public ClientSession sessionLogin(InetAddress host, String username, String password) throws IOException {
-        return sessionLogin(host, DEFAULT_PORT, username, password);
-    }
-
-    @Override
-    public ClientSession sessionLogin(InetAddress host, String username, KeyPair identity) throws IOException {
-        return sessionLogin(host, DEFAULT_PORT, username, identity);
-    }
-
-    @Override   // TODO make this a default method in Java-8
-    public ClientSession sessionLogin(String host, int port, String username, String password) throws IOException {
-        return sessionLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No host")), port, username, password);
-    }
-
-    @Override   // TODO make this a default method in Java-8
-    public ClientSession sessionLogin(InetAddress host, int port, String username, String password) throws IOException {
-        return sessionLogin(new InetSocketAddress(ValidateUtils.checkNotNull(host, "No host address"), port), username, password);
-    }
-
-    @Override   // TODO make this a default method in Java-8
-    public ClientSession sessionLogin(String host, int port, String username, KeyPair identity) throws IOException {
-        return sessionLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No host")), port, username, identity);
-    }
-
-    @Override
-    public ClientSession sessionLogin(InetAddress host, int port, String username, KeyPair identity) throws IOException {
-        return sessionLogin(new InetSocketAddress(ValidateUtils.checkNotNull(host, "No host address"), port), username, identity);
-    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClientSessionCreator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClientSessionCreator.java b/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClientSessionCreator.java
index c6fe238..0a44c22 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClientSessionCreator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClientSessionCreator.java
@@ -151,7 +151,7 @@ public abstract class AbstractSimpleClientSessionCreator extends AbstractSimpleC
 
             @Override
             public ConnectFuture connect(HostConfigEntry hostConfig) throws IOException {
-                return connect(hostConfig);
+                return creator.connect(hostConfig);
             }
 
             @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSessionClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSessionClient.java b/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSessionClient.java
index a21257a..d15a496 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSessionClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSessionClient.java
@@ -21,11 +21,13 @@ package org.apache.sshd.client.simple;
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.nio.channels.Channel;
 import java.security.KeyPair;
 
 import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.common.util.ValidateUtils;
 
 /**
  * A simplified <U>synchronous</U> API for creating client sessions
@@ -42,7 +44,9 @@ public interface SimpleSessionClient extends SimpleClientConfigurator, Channel {
      * @return Created {@link ClientSession}
      * @throws IOException If failed to login or authenticate
      */
-    ClientSession sessionLogin(String host, String username, String password) throws IOException;
+    default ClientSession sessionLogin(String host, String username, String password) throws IOException {
+        return sessionLogin(host, DEFAULT_PORT, username, password);
+    }
 
     /**
      * Creates a session and logs in using the provided credentials
@@ -54,7 +58,9 @@ public interface SimpleSessionClient extends SimpleClientConfigurator, Channel {
      * @return Created {@link ClientSession}
      * @throws IOException If failed to login or authenticate
      */
-    ClientSession sessionLogin(String host, int port, String username, String password) throws IOException;
+    default ClientSession sessionLogin(String host, int port, String username, String password) throws IOException {
+        return sessionLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No host")), port, username, password);
+    }
 
     /**
      * Creates a session on the default port and logs in using the provided credentials
@@ -65,7 +71,9 @@ public interface SimpleSessionClient extends SimpleClientConfigurator, Channel {
      * @return Created {@link ClientSession}
      * @throws IOException If failed to login or authenticate
      */
-    ClientSession sessionLogin(String host, String username, KeyPair identity) throws IOException;
+    default ClientSession sessionLogin(String host, String username, KeyPair identity) throws IOException {
+        return sessionLogin(host, DEFAULT_PORT, username, identity);
+    }
 
     /**
      * Creates a session and logs in using the provided credentials
@@ -77,7 +85,9 @@ public interface SimpleSessionClient extends SimpleClientConfigurator, Channel {
      * @return Created {@link ClientSession}
      * @throws IOException If failed to login or authenticate
      */
-    ClientSession sessionLogin(String host, int port, String username, KeyPair identity) throws IOException;
+    default ClientSession sessionLogin(String host, int port, String username, KeyPair identity) throws IOException {
+        return sessionLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No host")), port, username, identity);
+    }
 
     /**
      * Creates a session on the default port and logs in using the provided credentials
@@ -88,7 +98,9 @@ public interface SimpleSessionClient extends SimpleClientConfigurator, Channel {
      * @return Created {@link ClientSession}
      * @throws IOException If failed to login or authenticate
      */
-    ClientSession sessionLogin(InetAddress host, String username, String password) throws IOException;
+    default ClientSession sessionLogin(InetAddress host, String username, String password) throws IOException {
+        return sessionLogin(host, DEFAULT_PORT, username, password);
+    }
 
     /**
      * Creates a session and logs in using the provided credentials
@@ -100,7 +112,9 @@ public interface SimpleSessionClient extends SimpleClientConfigurator, Channel {
      * @return Created {@link ClientSession}
      * @throws IOException If failed to login or authenticate
      */
-    ClientSession sessionLogin(InetAddress host, int port, String username, String password) throws IOException;
+    default ClientSession sessionLogin(InetAddress host, int port, String username, String password) throws IOException {
+        return sessionLogin(new InetSocketAddress(ValidateUtils.checkNotNull(host, "No host address"), port), username, password);
+    }
 
     /**
      * Creates a session on the default port and logs in using the provided credentials
@@ -111,7 +125,9 @@ public interface SimpleSessionClient extends SimpleClientConfigurator, Channel {
      * @return Created {@link ClientSession}
      * @throws IOException If failed to login or authenticate
      */
-    ClientSession sessionLogin(InetAddress host, String username, KeyPair identity) throws IOException;
+    default ClientSession sessionLogin(InetAddress host, String username, KeyPair identity) throws IOException {
+        return sessionLogin(host, DEFAULT_PORT, username, identity);
+    }
 
     /**
      * Creates a session and logs in using the provided credentials
@@ -123,7 +139,9 @@ public interface SimpleSessionClient extends SimpleClientConfigurator, Channel {
      * @return Created {@link ClientSession}
      * @throws IOException If failed to login or authenticate
      */
-    ClientSession sessionLogin(InetAddress host, int port, String username, KeyPair identity) throws IOException;
+    default ClientSession sessionLogin(InetAddress host, int port, String username, KeyPair identity) throws IOException {
+        return sessionLogin(new InetSocketAddress(ValidateUtils.checkNotNull(host, "No host address"), port), username, identity);
+    }
 
     /**
      * Creates a session and logs in using the provided credentials

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSftpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSftpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSftpClient.java
index fb52aee..8776ad3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSftpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSftpClient.java
@@ -21,11 +21,13 @@ package org.apache.sshd.client.simple;
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.nio.channels.Channel;
 import java.security.KeyPair;
 
 import org.apache.sshd.client.subsystem.sftp.SftpClient;
+import org.apache.sshd.common.util.ValidateUtils;
 
 /**
  * A simplified <U>synchronous</U> API for obtaining SFTP sessions.
@@ -43,7 +45,9 @@ public interface SimpleSftpClient extends SimpleClientConfigurator, Channel {
      * underlying session
      * @throws IOException If failed to login or authenticate
      */
-    SftpClient sftpLogin(String host, String username, String password) throws IOException;
+    default SftpClient sftpLogin(String host, String username, String password) throws IOException {
+        return sftpLogin(host, DEFAULT_PORT, username, password);
+    }
 
     /**
      * Creates an SFTP session using the provided credentials
@@ -56,7 +60,9 @@ public interface SimpleSftpClient extends SimpleClientConfigurator, Channel {
      * underlying session
      * @throws IOException If failed to login or authenticate
      */
-    SftpClient sftpLogin(String host, int port, String username, String password) throws IOException;
+    default SftpClient sftpLogin(String host, int port, String username, String password) throws IOException {
+        return sftpLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No host")), port, username, password);
+    }
 
     /**
      * Creates an SFTP session on the default port and logs in using the provided credentials
@@ -68,7 +74,9 @@ public interface SimpleSftpClient extends SimpleClientConfigurator, Channel {
      * underlying session
      * @throws IOException If failed to login or authenticate
      */
-    SftpClient sftpLogin(String host, String username, KeyPair identity) throws IOException;
+    default SftpClient sftpLogin(String host, String username, KeyPair identity) throws IOException {
+        return sftpLogin(host, DEFAULT_PORT, username, identity);
+    }
 
     /**
      * Creates an SFTP session using the provided credentials
@@ -81,7 +89,9 @@ public interface SimpleSftpClient extends SimpleClientConfigurator, Channel {
      * underlying session
      * @throws IOException If failed to login or authenticate
      */
-    SftpClient sftpLogin(String host, int port, String username, KeyPair identity) throws IOException;
+    default SftpClient sftpLogin(String host, int port, String username, KeyPair identity) throws IOException {
+        return sftpLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No host")), port, username, identity);
+    }
 
     /**
      * Creates an SFTP session on the default port and logs in using the provided credentials
@@ -93,7 +103,9 @@ public interface SimpleSftpClient extends SimpleClientConfigurator, Channel {
      * underlying session
      * @throws IOException If failed to login or authenticate
      */
-    SftpClient sftpLogin(InetAddress host, String username, String password) throws IOException;
+    default SftpClient sftpLogin(InetAddress host, String username, String password) throws IOException {
+        return sftpLogin(host, DEFAULT_PORT, username, password);
+    }
 
     /**
      * Creates an SFTP session using the provided credentials
@@ -106,7 +118,9 @@ public interface SimpleSftpClient extends SimpleClientConfigurator, Channel {
      * underlying session
      * @throws IOException If failed to login or authenticate
      */
-    SftpClient sftpLogin(InetAddress host, int port, String username, String password) throws IOException;
+    default SftpClient sftpLogin(InetAddress host, int port, String username, String password) throws IOException {
+        return sftpLogin(new InetSocketAddress(ValidateUtils.checkNotNull(host, "No host address"), port), username, password);
+    }
 
     /**
      * Creates an SFTP session on the default port and logs in using the provided credentials
@@ -118,7 +132,9 @@ public interface SimpleSftpClient extends SimpleClientConfigurator, Channel {
      * underlying session
      * @throws IOException If failed to login or authenticate
      */
-    SftpClient sftpLogin(InetAddress host, String username, KeyPair identity) throws IOException;
+    default SftpClient sftpLogin(InetAddress host, String username, KeyPair identity) throws IOException {
+        return sftpLogin(host, DEFAULT_PORT, username, identity);
+    }
 
     /**
      * Creates an SFTP session using the provided credentials
@@ -131,7 +147,9 @@ public interface SimpleSftpClient extends SimpleClientConfigurator, Channel {
      * underlying session
      * @throws IOException If failed to login or authenticate
      */
-    SftpClient sftpLogin(InetAddress host, int port, String username, KeyPair identity) throws IOException;
+    default SftpClient sftpLogin(InetAddress host, int port, String username, KeyPair identity) throws IOException {
+        return sftpLogin(new InetSocketAddress(ValidateUtils.checkNotNull(host, "No host address"), port), username, identity);
+    }
 
     /**
      * Creates an SFTP session using the provided credentials

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClient.java
index ecf6ffb..848790c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClient.java
@@ -141,6 +141,7 @@ public abstract class AbstractSftpClient extends AbstractSubsystemClient impleme
             String lang = buffer.getString();
             checkResponseStatus(cmd, id, substatus, msg, lang);
         } else {
+            //noinspection ThrowableResultOfMethodCallIgnored
             handleUnexpectedPacket(cmd, SftpConstants.SSH_FXP_STATUS, id, type, length, buffer);
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
index dddcfd5..8650332 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/DefaultSftpClient.java
@@ -89,18 +89,14 @@ public class DefaultSftpClient extends AbstractSftpClient {
 
         long initializationTimeout = PropertyResolverUtils.getLongProperty(clientSession, SFTP_CHANNEL_OPEN_TIMEOUT, DEFAULT_CHANNEL_OPEN_TIMEOUT);
         this.channel.open().verify(initializationTimeout);
-        this.channel.onClose(new Runnable() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public void run() {
-                synchronized (messages) {
-                    closing.set(true);
-                    messages.notifyAll();
-                }
+        this.channel.onClose(() -> {
+            synchronized (messages) {
+                closing.set(true);
+                messages.notifyAll();
+            }
 
-                if (versionHolder.get() <= 0) {
-                    log.warn("onClose({}) closed before version negotiated", channel);
-                }
+            if (versionHolder.get() <= 0) {
+                log.warn("onClose({}) closed before version negotiated", channel);
             }
         });
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientCreator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientCreator.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientCreator.java
index 2f93c90..8e41729 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientCreator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientCreator.java
@@ -46,7 +46,7 @@ public interface SftpClientCreator {
      * @throws IOException If failed to create the client or use the specified version
      */
     default SftpClient createSftpClient(int version) throws IOException {
-        return createSftpClient(SftpVersionSelector.Utils.fixedVersionSelector(version));
+        return createSftpClient(SftpVersionSelector.fixedVersionSelector(version));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystem.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystem.java
index 4a1bc7a..96c40a4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystem.java
@@ -27,7 +27,6 @@ import java.nio.file.FileSystemException;
 import java.nio.file.attribute.GroupPrincipal;
 import java.nio.file.attribute.UserPrincipal;
 import java.nio.file.attribute.UserPrincipalLookupService;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -56,9 +55,7 @@ public class SftpFileSystem extends BaseFileSystem<SftpPath> implements ClientSe
     public static final Set<String> UNIVERSAL_SUPPORTED_VIEWS =
             Collections.unmodifiableSet(
                     GenericUtils.asSortedSet(String.CASE_INSENSITIVE_ORDER,
-                            Arrays.asList(
-                                    "basic", "posix", "owner"
-                            )));
+                            "basic", "posix", "owner"));
 
     private final String id;
     private final ClientSession clientSession;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java
index 48b10d2..3ecd93c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java
@@ -118,15 +118,12 @@ public class SftpFileSystemProvider extends FileSystemProvider {
     public static final String VERSION_PARAM = "version";
 
     public static final Set<Class<? extends FileAttributeView>> UNIVERSAL_SUPPORTED_VIEWS =
-            Collections.unmodifiableSet(new HashSet<Class<? extends FileAttributeView>>() {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
+            Collections.unmodifiableSet(GenericUtils.asSet(
+                    PosixFileAttributeView.class,
+                    FileOwnerAttributeView.class,
+                    BasicFileAttributeView.class
+            ));
 
-                {
-                    add(PosixFileAttributeView.class);
-                    add(FileOwnerAttributeView.class);
-                    add(BasicFileAttributeView.class);
-                }
-            });
     protected final Logger log;
 
     private final SshClient client;
@@ -270,7 +267,7 @@ public class SftpFileSystemProvider extends FileSystemProvider {
 
         String[] values = GenericUtils.split(preference, ',');
         if (values.length == 1) {
-            return SftpVersionSelector.Utils.fixedVersionSelector(Integer.parseInt(values[0]));
+            return SftpVersionSelector.fixedVersionSelector(Integer.parseInt(values[0]));
         }
 
         int[] preferred = new int[values.length];
@@ -278,7 +275,7 @@ public class SftpFileSystemProvider extends FileSystemProvider {
             preferred[index] = Integer.parseInt(values[index]);
         }
 
-        return SftpVersionSelector.Utils.preferredVersionSelector(preferred);
+        return SftpVersionSelector.preferredVersionSelector(preferred);
     }
 
     // NOTE: URI parameters override environment ones
@@ -431,6 +428,7 @@ public class SftpFileSystemProvider extends FileSystemProvider {
                  *      The option is ignored when the file system does not
                  *  support the creation of sparse files
                  */
+                //noinspection UnnecessaryContinue
                 continue;
             } else {
                 throw new IllegalArgumentException("newFileChannel(" + path + ") unsupported open option: " + option);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpPosixFileAttributes.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpPosixFileAttributes.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpPosixFileAttributes.java
index d5c9df3..a07e67f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpPosixFileAttributes.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpPosixFileAttributes.java
@@ -25,6 +25,7 @@ import java.nio.file.attribute.PosixFileAttributes;
 import java.nio.file.attribute.PosixFilePermission;
 import java.nio.file.attribute.UserPrincipal;
 import java.util.Set;
+
 import org.apache.sshd.client.subsystem.sftp.SftpClient.Attributes;
 import org.apache.sshd.common.util.GenericUtils;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
index a8fa062..a0d80e7 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
@@ -21,6 +21,7 @@ package org.apache.sshd.client.subsystem.sftp;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.stream.StreamSupport;
 
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.util.GenericUtils;
@@ -36,63 +37,19 @@ public interface SftpVersionSelector {
     /**
      * An {@link SftpVersionSelector} that returns the current version
      */
-    SftpVersionSelector CURRENT = new SftpVersionSelector() {
-        @Override
-        public int selectVersion(ClientSession session, int current, List<Integer> available) {
-            return current;
-        }
-
-        @Override
-        public String toString() {
-            return "CURRENT";
-        }
-    };
+    SftpVersionSelector CURRENT = new NamedVersionSelector("CURRENT", (session, current, available) -> current);
 
     /**
      * An {@link SftpVersionSelector} that returns the maximum available version
      */
-    SftpVersionSelector MAXIMUM = new SftpVersionSelector() {
-        @Override
-        public int selectVersion(ClientSession session, int current, List<Integer> available) {
-            int candidate = current;
-            if (GenericUtils.size(available) > 0) {
-                for (Number version : available) {
-                    if (candidate < version.intValue()) {
-                        candidate = version.intValue();
-                    }
-                }
-            }
-            return candidate;
-        }
-
-        @Override
-        public String toString() {
-            return "MAXIMUM";
-        }
-    };
+    SftpVersionSelector MAXIMUM = new NamedVersionSelector("MAXIMUM", (session, current, available) ->
+            GenericUtils.stream(available).mapToInt(Integer::intValue).max().orElse(current));
 
     /**
      * An {@link SftpVersionSelector} that returns the maximum available version
      */
-    SftpVersionSelector MINIMUM = new SftpVersionSelector() {
-        @Override
-        public int selectVersion(ClientSession session, int current, List<Integer> available) {
-            int candidate = current;
-            if (GenericUtils.size(available) > 0) {
-                for (Number version : available) {
-                    if (candidate > version.intValue()) {
-                        candidate = version.intValue();
-                    }
-                }
-            }
-            return candidate;
-        }
-
-        @Override
-        public String toString() {
-            return "MINIMUM";
-        }
-    };
+    SftpVersionSelector MINIMUM = new NamedVersionSelector("MINIMUM", (session, current, available) ->
+            GenericUtils.stream(available).mapToInt(Integer::intValue).min().orElse(current));
 
     /**
      * @param session   The {@link ClientSession} through which the SFTP connection is made
@@ -107,6 +64,7 @@ public interface SftpVersionSelector {
      * Utility class to help using {@link SftpVersionSelector}s
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
 
@@ -114,75 +72,85 @@ public interface SftpVersionSelector {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * Creates a selector the always returns the requested (fixed version) regardless
-         * of what the current or reported available versions are. If the requested version
-         * is not reported as available then an exception will be eventually thrown by the
-         * client during re-negotiation phase.
-         *
-         * @param version The requested version
-         * @return The {@link SftpVersionSelector}
-         */
         public static SftpVersionSelector fixedVersionSelector(final int version) {
-            return new SftpVersionSelector() {
-                @Override
-                public int selectVersion(ClientSession session, int current, List<Integer> available) {
-                    return version;
-                }
-            };
+            return SftpVersionSelector.fixedVersionSelector(version);
         }
 
-        /**
-         * Selects a version in order of preference - if none of the preferred
-         * versions is listed as available then an exception is thrown when the
-         * {@link SftpVersionSelector#selectVersion(int, List)} method is invoked
-         *
-         * @param preferred The preferred versions in decreasing order of
-         * preference (i.e., most preferred is 1st) - may not be {@code null}/empty
-         * @return A {@link SftpVersionSelector} that attempts to select
-         * the most preferred version that is also listed as available.
-         */
         public static SftpVersionSelector preferredVersionSelector(final int ... preferred) {
-            return preferredVersionSelector(NumberUtils.asList(preferred));
+            return SftpVersionSelector.preferredVersionSelector(preferred);
 
         }
 
-        /**
-         * Selects a version in order of preference - if none of the preferred
-         * versions is listed as available then an exception is thrown when the
-         * {@link SftpVersionSelector#selectVersion(int, List)} method is invoked
-         *
-         * @param preferred The preferred versions in decreasing order of
-         * preference (i.e., most preferred is 1st)
-         * @return A {@link SftpVersionSelector} that attempts to select
-         * the most preferred version that is also listed as available.
-         */
         public static SftpVersionSelector preferredVersionSelector(final Iterable<? extends Number> preferred) {
-            if (preferred instanceof Collection<?>) {
-                ValidateUtils.checkNotNullAndNotEmpty((Collection<?>) preferred, "Empty preferred versions");
-            } else {
-                ValidateUtils.checkNotNull(preferred, "No preferred versions");
-            }
-
-            return new SftpVersionSelector() {
-                @Override
-                public int selectVersion(ClientSession session, int current, List<Integer> available) {
-                    for (Number prefValue : preferred) {
-                        int version = prefValue.intValue();
-                        if (version == current) {
-                            return version;
-                        }
-
-                        for (Integer avail : available) {
-                            if (version == avail) {
-                                return version;
-                            }
-                        }
-                    }
-
-                    throw new IllegalStateException("Preferred versions (" + preferred + ") not available: " + available);
-                }
-            };
+            return SftpVersionSelector.preferredVersionSelector(preferred);
         }
     }
+
+    /**
+     * Creates a selector the always returns the requested (fixed version) regardless
+     * of what the current or reported available versions are. If the requested version
+     * is not reported as available then an exception will be eventually thrown by the
+     * client during re-negotiation phase.
+     *
+     * @param version The requested version
+     * @return The {@link SftpVersionSelector}
+     */
+    static SftpVersionSelector fixedVersionSelector(final int version) {
+        return (session, current, available) -> version;
+    }
+
+    /**
+     * Selects a version in order of preference - if none of the preferred
+     * versions is listed as available then an exception is thrown when the
+     * {@link SftpVersionSelector#selectVersion(ClientSession, int, List)} method is invoked
+     *
+     * @param preferred The preferred versions in decreasing order of
+     * preference (i.e., most preferred is 1st) - may not be {@code null}/empty
+     * @return A {@link SftpVersionSelector} that attempts to select
+     * the most preferred version that is also listed as available.
+     */
+    static SftpVersionSelector preferredVersionSelector(final int ... preferred) {
+        return preferredVersionSelector(NumberUtils.asList(preferred));
+
+    }
+
+    /**
+     * Selects a version in order of preference - if none of the preferred
+     * versions is listed as available then an exception is thrown when the
+     * {@link SftpVersionSelector#selectVersion(ClientSession, int, List)} method is invoked
+     *
+     * @param preferred The preferred versions in decreasing order of
+     * preference (i.e., most preferred is 1st)
+     * @return A {@link SftpVersionSelector} that attempts to select
+     * the most preferred version that is also listed as available.
+     */
+    static SftpVersionSelector preferredVersionSelector(final Iterable<? extends Number> preferred) {
+        ValidateUtils.checkNotNullAndNotEmpty((Collection<?>) preferred, "Empty preferred versions");
+        return (session, current, available) -> StreamSupport.stream(preferred.spliterator(), false)
+                .mapToInt(Number::intValue)
+                .filter(v -> v == current || available.contains(v))
+                .findFirst()
+                .orElseThrow(() -> new IllegalStateException("Preferred versions (" + preferred + ") not available: " + available));
+    }
+
+    class NamedVersionSelector implements SftpVersionSelector {
+        private final String name;
+        private final SftpVersionSelector selector;
+
+        public NamedVersionSelector(String name, SftpVersionSelector selector) {
+            this.name = name;
+            this.selector = selector;
+        }
+
+        @Override
+        public int selectVersion(ClientSession session, int current, List<Integer> available) {
+            return selector.selectVersion(session, current, available);
+        }
+
+        @Override
+        public String toString() {
+            return name;
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/BuiltinSftpClientExtensions.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/BuiltinSftpClientExtensions.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/BuiltinSftpClientExtensions.java
index dda5e00..9e83837 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/BuiltinSftpClientExtensions.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/BuiltinSftpClientExtensions.java
@@ -133,7 +133,7 @@ public enum BuiltinSftpClientExtensions implements SftpClientExtensionFactory {
     }
 
     public static BuiltinSftpClientExtensions fromName(String n) {
-        return NamedResource.Utils.findByName(n, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(n, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     public static BuiltinSftpClientExtensions fromInstance(Object o) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
index 949cca3..ecd60dd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
@@ -47,11 +47,11 @@ public abstract class AbstractSftpClientExtension extends AbstractLoggingBean im
     private final boolean supported;
 
     protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Collection<String> extras) {
-        this(name, client, raw, !GenericUtils.isEmpty(extras) && extras.contains(name));
+        this(name, client, raw, GenericUtils.isNotEmpty(extras) && extras.contains(name));
     }
 
     protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) {
-        this(name, client, raw, !GenericUtils.isEmpty(extensions) && extensions.containsKey(name));
+        this(name, client, raw, GenericUtils.isNotEmpty(extensions) && extensions.containsKey(name));
     }
 
     protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, boolean supported) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/AttributeStore.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/AttributeStore.java b/sshd-core/src/main/java/org/apache/sshd/common/AttributeStore.java
index 9b0c38a..b09a746 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/AttributeStore.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/AttributeStore.java
@@ -104,61 +104,74 @@ public interface AttributeStore {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
         private Utils() {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * @param <T> The generic attribute type
-         * @param manager The {@link FactoryManager} - ignored if {@code null}
-         * @param key The attribute key - never {@code null}
-         * @return Associated value - {@code null} if not found
-         */
         public static <T> T resolveAttribute(FactoryManager manager, AttributeKey<T> key) {
-            ValidateUtils.checkNotNull(key, "No key");
-            return (manager == null) ? null : manager.getAttribute(key);
+            return AttributeStore.resolveAttribute(manager, key);
         }
 
-        /**
-         * Attempts to use the session's attribute, if not found then tries the factory manager
-         *
-         * @param <T> The generic attribute type
-         * @param session The {@link Session} - ignored if {@code null}
-         * @param key The attribute key - never {@code null}
-         * @return Associated value - {@code null} if not found
-         * @see Session#getFactoryManager()
-         * @see #resolveAttribute(FactoryManager, AttributeKey)
-         */
         public static <T> T resolveAttribute(Session session, AttributeKey<T> key) {
-            ValidateUtils.checkNotNull(key, "No key");
-            if (session == null) {
-                return null;
-            }
-
-            T value = session.getAttribute(key);
-            return (value != null) ? value : resolveAttribute(session.getFactoryManager(), key);
+            return AttributeStore.resolveAttribute(session, key);
         }
 
-        /**
-         * Attempts to use the channel attribute, if not found then tries the session
-         *
-         * @param <T> The generic attribute type
-         * @param channel The {@link Channel} - ignored if {@code null}
-         * @param key The attribute key - never {@code null}
-         * @return Associated value - {@code null} if not found
-         * @see Session#getFactoryManager()
-         * @see #resolveAttribute(Session, AttributeKey)
-         */
         public static <T> T resolveAttribute(Channel channel, AttributeKey<T> key) {
-            ValidateUtils.checkNotNull(key, "No key");
-            if (channel == null) {
-                return null;
-            }
+            return AttributeStore.resolveAttribute(channel, key);
+        }
+    }
 
-            T value = channel.getAttribute(key);
-            return (value != null) ? value : resolveAttribute(channel.getSession(), key);
+    /**
+     * @param <T> The generic attribute type
+     * @param manager The {@link FactoryManager} - ignored if {@code null}
+     * @param key The attribute key - never {@code null}
+     * @return Associated value - {@code null} if not found
+     */
+    static <T> T resolveAttribute(FactoryManager manager, AttributeKey<T> key) {
+        ValidateUtils.checkNotNull(key, "No key");
+        return (manager == null) ? null : manager.getAttribute(key);
+    }
+
+    /**
+     * Attempts to use the session's attribute, if not found then tries the factory manager
+     *
+     * @param <T> The generic attribute type
+     * @param session The {@link Session} - ignored if {@code null}
+     * @param key The attribute key - never {@code null}
+     * @return Associated value - {@code null} if not found
+     * @see Session#getFactoryManager()
+     * @see #resolveAttribute(FactoryManager, AttributeKey)
+     */
+    static <T> T resolveAttribute(Session session, AttributeKey<T> key) {
+        ValidateUtils.checkNotNull(key, "No key");
+        if (session == null) {
+            return null;
+        }
+
+        T value = session.getAttribute(key);
+        return (value != null) ? value : resolveAttribute(session.getFactoryManager(), key);
+    }
+
+    /**
+     * Attempts to use the channel attribute, if not found then tries the session
+     *
+     * @param <T> The generic attribute type
+     * @param channel The {@link Channel} - ignored if {@code null}
+     * @param key The attribute key - never {@code null}
+     * @return Associated value - {@code null} if not found
+     * @see Session#getFactoryManager()
+     * @see #resolveAttribute(Session, AttributeKey)
+     */
+    static <T> T resolveAttribute(Channel channel, AttributeKey<T> key) {
+        ValidateUtils.checkNotNull(key, "No key");
+        if (channel == null) {
+            return null;
         }
+
+        T value = channel.getAttribute(key);
+        return (value != null) ? value : resolveAttribute(channel.getSession(), key);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java b/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java
index 2f2ebd0..081db31 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java
@@ -281,7 +281,7 @@ public class BaseBuilder<T extends AbstractFactoryManager, S extends BaseBuilder
      * @see BuiltinCiphers#isSupported()
      */
     public static List<NamedFactory<Cipher>> setUpDefaultCiphers(boolean ignoreUnsupported) {
-        return NamedFactory.Utils.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_CIPHERS_PREFERENCE);
+        return NamedFactory.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_CIPHERS_PREFERENCE);
     }
 
     /**
@@ -296,7 +296,7 @@ public class BaseBuilder<T extends AbstractFactoryManager, S extends BaseBuilder
      * @see BuiltinMacs#isSupported()
      */
     public static List<NamedFactory<Mac>> setUpDefaultMacs(boolean ignoreUnsupported) {
-        return NamedFactory.Utils.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_MAC_PREFERENCE);
+        return NamedFactory.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_MAC_PREFERENCE);
     }
 
     /**
@@ -311,6 +311,6 @@ public class BaseBuilder<T extends AbstractFactoryManager, S extends BaseBuilder
      * @see BuiltinSignatures#isSupported()
      */
     public static List<NamedFactory<Signature>> setUpDefaultSignatures(boolean ignoreUnsupported) {
-        return NamedFactory.Utils.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_SIGNATURE_PREFERENCE);
+        return NamedFactory.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_SIGNATURE_PREFERENCE);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java
index 7a138e8..1e436c6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java
@@ -18,9 +18,11 @@
  */
 package org.apache.sshd.common;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.sshd.common.util.GenericUtils;
 
 /**
  * A named optional factory.
@@ -31,6 +33,7 @@ import java.util.List;
 public interface BuiltinFactory<T> extends NamedFactory<T>, OptionalFeature {
 
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
 
@@ -40,13 +43,15 @@ public interface BuiltinFactory<T> extends NamedFactory<T>, OptionalFeature {
 
         public static <T, E extends BuiltinFactory<T>> List<NamedFactory<T>> setUpFactories(
                 boolean ignoreUnsupported, Collection<? extends E> preferred) {
-            List<NamedFactory<T>> avail = new ArrayList<>(preferred.size());
-            for (E f : preferred) {
-                if (ignoreUnsupported || f.isSupported()) {
-                    avail.add(f);
-                }
-            }
-            return avail;
+            return BuiltinFactory.setUpFactories(ignoreUnsupported, preferred);
         }
     }
+
+    static <T, E extends BuiltinFactory<T>> List<NamedFactory<T>> setUpFactories(
+            boolean ignoreUnsupported, Collection<? extends E> preferred) {
+        return GenericUtils.stream(preferred)
+                .filter(f -> ignoreUnsupported || f.isSupported())
+                .collect(Collectors.toList());
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/Closeable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/Closeable.java b/sshd-core/src/main/java/org/apache/sshd/common/Closeable.java
index f86a00f..0c7f2bb 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/Closeable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/Closeable.java
@@ -18,7 +18,10 @@
  */
 package org.apache.sshd.common;
 
+import java.io.IOException;
+import java.net.SocketTimeoutException;
 import java.nio.channels.Channel;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.common.future.CloseFuture;
 import org.apache.sshd.common.future.SshFutureListener;
@@ -34,6 +37,18 @@ import org.apache.sshd.common.future.SshFutureListener;
 public interface Closeable extends Channel {
 
     /**
+     * Timeout (milliseconds) for waiting on a {@link CloseFuture} to successfully
+     * complete its action.
+     * @see #DEFAULT_CLOSE_WAIT_TIMEOUT
+     */
+    String CLOSE_WAIT_TIMEOUT = "sshd-close-wait-time";
+
+    /**
+     * Default value for {@link #CLOSE_WAIT_TIMEOUT} if none specified
+     */
+    long DEFAULT_CLOSE_WAIT_TIMEOUT = TimeUnit.SECONDS.toMillis(15L);
+
+    /**
      * Close this resource asynchronously and return a future.
      * Resources support two closing modes: a graceful mode
      * which will cleanly close the resource and an immediate mode
@@ -78,4 +93,32 @@ public interface Closeable extends Channel {
      */
     boolean isClosing();
 
+    default boolean isOpen() {
+        return !(isClosed() || isClosing());
+    }
+
+    @Override
+    default void close() throws IOException {
+        Closeable.close(this);
+    }
+
+    static long getMaxCloseWaitTime(PropertyResolver resolver) {
+        return (resolver == null) ? DEFAULT_CLOSE_WAIT_TIMEOUT
+                : PropertyResolverUtils.getLongProperty(resolver, CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT);
+    }
+
+    static void close(Closeable closeable) throws IOException {
+        if (closeable == null) {
+            return;
+        }
+        if ((!closeable.isClosed()) && (!closeable.isClosing())) {
+            CloseFuture future = closeable.close(true);
+            long maxWait = (closeable instanceof PropertyResolver)
+                    ? getMaxCloseWaitTime((PropertyResolver) closeable) : DEFAULT_CLOSE_WAIT_TIMEOUT;
+            boolean successful = future.await(maxWait);
+            if (!successful) {
+                throw new SocketTimeoutException("Failed to receive closure confirmation within " + maxWait + " millis");
+            }
+        }
+    }
 }


[10/16] mina-sshd git commit: [SSHD-698] Use lambda and method references, streams Deprecate Utils inner classes and use interface methods instead.

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java
index 9ddeb30..d337244 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtensionTest.java
@@ -28,7 +28,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 
@@ -68,40 +67,39 @@ public class AbstractCheckFileExtensionTest extends AbstractSftpClientTestSuppor
     private static final Collection<Integer> DATA_SIZES =
             Collections.unmodifiableList(
                     Arrays.asList(
-                            Integer.valueOf(Byte.MAX_VALUE),
-                            Integer.valueOf(SftpConstants.MIN_CHKFILE_BLOCKSIZE),
-                            Integer.valueOf(IoUtils.DEFAULT_COPY_SIZE),
-                            Integer.valueOf(Byte.SIZE * IoUtils.DEFAULT_COPY_SIZE)
+                            (int) Byte.MAX_VALUE,
+                            SftpConstants.MIN_CHKFILE_BLOCKSIZE,
+                            IoUtils.DEFAULT_COPY_SIZE,
+                            Byte.SIZE * IoUtils.DEFAULT_COPY_SIZE
                     ));
     private static final Collection<Integer> BLOCK_SIZES =
             Collections.unmodifiableList(
                     Arrays.asList(
-                            Integer.valueOf(0),
-                            Integer.valueOf(SftpConstants.MIN_CHKFILE_BLOCKSIZE),
-                            Integer.valueOf(1024),
-                            Integer.valueOf(IoUtils.DEFAULT_COPY_SIZE)
+                            0,
+                            SftpConstants.MIN_CHKFILE_BLOCKSIZE,
+                            1024,
+                            IoUtils.DEFAULT_COPY_SIZE
                     ));
-    @SuppressWarnings("synthetic-access")
-    private static final Collection<Object[]> PARAMETERS =
-            Collections.unmodifiableCollection(new LinkedList<Object[]>() {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    for (DigestFactory factory : BuiltinDigests.VALUES) {
-                        if (!factory.isSupported()) {
-                            System.out.println("Skip unsupported digest=" + factory.getAlgorithm());
-                            continue;
-                        }
-
-                        String algorithm = factory.getName();
-                        for (Number dataSize : DATA_SIZES) {
-                            for (Number blockSize : BLOCK_SIZES) {
-                                add(new Object[]{algorithm, dataSize, blockSize});
-                            }
-                        }
-                    }
+    private static final Collection<Object[]> PARAMETERS;
+
+    static {
+        Collection<Object[]> list = new ArrayList<>();
+        for (DigestFactory factory : BuiltinDigests.VALUES) {
+            if (!factory.isSupported()) {
+                System.out.println("Skip unsupported digest=" + factory.getAlgorithm());
+                continue;
+            }
+
+            String algorithm = factory.getName();
+            for (Number dataSize : DATA_SIZES) {
+                for (Number blockSize : BLOCK_SIZES) {
+                    list.add(new Object[]{algorithm, dataSize, blockSize});
                 }
-            });
+            }
+        }
+        PARAMETERS = list;
+    }
+
 
     private final String algorithm;
     private final int dataSize;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java
index 6c63b6f..12ebf4b 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtensionTest.java
@@ -63,10 +63,10 @@ public class AbstractMD5HashExtensionTest extends AbstractSftpClientTestSupport
     private static final List<Integer> DATA_SIZES =
             Collections.unmodifiableList(
                     Arrays.asList(
-                            Integer.valueOf(Byte.MAX_VALUE),
-                            Integer.valueOf(SftpConstants.MD5_QUICK_HASH_SIZE),
-                            Integer.valueOf(IoUtils.DEFAULT_COPY_SIZE),
-                            Integer.valueOf(Byte.SIZE * IoUtils.DEFAULT_COPY_SIZE)
+                            (int) Byte.MAX_VALUE,
+                            SftpConstants.MD5_QUICK_HASH_SIZE,
+                            IoUtils.DEFAULT_COPY_SIZE,
+                            Byte.SIZE * IoUtils.DEFAULT_COPY_SIZE
                     ));
 
     private final int size;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java b/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java
index 9c4bcd6..6f73123 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java
@@ -30,8 +30,6 @@ import org.junit.Test;
 import org.junit.runners.MethodSorters;
 import org.mockito.Matchers;
 import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
@@ -46,67 +44,58 @@ public class AttributeStoreTest extends BaseTestSupport {
 
     @Test
     public void testResolveFactoryManagerAttribute() {
-        assertNull("Unexpected null factory value", AttributeStore.Utils.resolveAttribute((FactoryManager) null, KEY));
+        assertNull("Unexpected null factory value", AttributeStore.resolveAttribute((FactoryManager) null, KEY));
 
         FactoryManager manager = Mockito.mock(FactoryManager.class);
         String expected = setAttributeValue(manager, getCurrentTestName());
-        assertSame("Mismatched resolved value", expected, AttributeStore.Utils.resolveAttribute(manager, KEY));
+        assertSame("Mismatched resolved value", expected, AttributeStore.resolveAttribute(manager, KEY));
     }
 
     @Test
     public void testResolveSessionAttribute() {
-        assertNull("Unexpected null session value", AttributeStore.Utils.resolveAttribute((Session) null, KEY));
+        assertNull("Unexpected null session value", AttributeStore.resolveAttribute((Session) null, KEY));
 
         Session session = Mockito.mock(Session.class);
         final AtomicInteger managerCount = new AtomicInteger(0);
-        Mockito.when(session.getFactoryManager()).then(new Answer<FactoryManager>() {
-            @Override
-            public FactoryManager answer(InvocationOnMock invocation) throws Throwable {
-                managerCount.incrementAndGet();
-                return null;
-            }
+        Mockito.when(session.getFactoryManager()).then(invocation -> {
+            managerCount.incrementAndGet();
+            return null;
         });
         setAttributeValue(session, null);
-        assertNull("Unexpected success for empty attribute", AttributeStore.Utils.resolveAttribute(session, KEY));
+        assertNull("Unexpected success for empty attribute", AttributeStore.resolveAttribute(session, KEY));
         assertEquals("Factory manager not requested", 1, managerCount.getAndSet(0));
 
         String expected = setAttributeValue(session, getCurrentTestName());
-        assertSame("Mismatched attribute value", expected, AttributeStore.Utils.resolveAttribute(session, KEY));
+        assertSame("Mismatched attribute value", expected, AttributeStore.resolveAttribute(session, KEY));
         assertEquals("Unexpected manager request", 0, managerCount.get());
     }
 
     @Test
     public void testResolveChannelAttribute() {
-        assertNull("Unexpected null channek value", AttributeStore.Utils.resolveAttribute((Channel) null, KEY));
+        assertNull("Unexpected null channek value", AttributeStore.resolveAttribute((Channel) null, KEY));
 
         final Session session = Mockito.mock(Session.class);
         final AtomicInteger managerCount = new AtomicInteger(0);
-        Mockito.when(session.getFactoryManager()).thenAnswer(new Answer<FactoryManager>() {
-            @Override
-            public FactoryManager answer(InvocationOnMock invocation) throws Throwable {
-                managerCount.incrementAndGet();
-                return null;
-            }
+        Mockito.when(session.getFactoryManager()).thenAnswer(invocation -> {
+            managerCount.incrementAndGet();
+            return null;
         });
         setAttributeValue(session, null);
 
         Channel channel = Mockito.mock(Channel.class);
         final AtomicInteger sessionCount = new AtomicInteger(0);
-        Mockito.when(channel.getSession()).thenAnswer(new Answer<Session>() {
-            @Override
-            public Session answer(InvocationOnMock invocation) throws Throwable {
-                sessionCount.incrementAndGet();
-                return session;
-            }
+        Mockito.when(channel.getSession()).thenAnswer(invocation -> {
+            sessionCount.incrementAndGet();
+            return session;
         });
         setAttributeValue(channel, null);
 
-        assertNull("Unexpected success for empty attribute", AttributeStore.Utils.resolveAttribute(channel, KEY));
+        assertNull("Unexpected success for empty attribute", AttributeStore.resolveAttribute(channel, KEY));
         assertEquals("Session not requested", 1, sessionCount.getAndSet(0));
         assertEquals("Factory manager not requested", 1, managerCount.getAndSet(0));
 
         String expected = setAttributeValue(channel, getCurrentTestName());
-        assertSame("Mismatched attribute value", expected, AttributeStore.Utils.resolveAttribute(channel, KEY));
+        assertSame("Mismatched attribute value", expected, AttributeStore.resolveAttribute(channel, KEY));
         assertEquals("Unexpected session request", 0, sessionCount.get());
         assertEquals("Unexpected manager request", 0, managerCount.get());
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/SshBuilderTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/SshBuilderTest.java b/sshd-core/src/test/java/org/apache/sshd/common/SshBuilderTest.java
index c0b7af2..fdbbe4c 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/SshBuilderTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/SshBuilderTest.java
@@ -114,7 +114,7 @@ public class SshBuilderTest extends BaseTestSupport {
             }
 
             // make sure order is according to the default preference list
-            List<String> cipherNames = NamedResource.Utils.getNameList(ciphers);
+            List<String> cipherNames = NamedResource.getNameList(ciphers);
             int nameIndex = 0;
             for (BuiltinCiphers c : BaseBuilder.DEFAULT_CIPHERS_PREFERENCE) {
                 if ((!c.isSupported()) && (!ignoreUnsupported)) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
index 1393de9..12b15fd 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
@@ -19,10 +19,8 @@
 package org.apache.sshd.common.auth;
 
 import java.io.IOException;
-import java.net.SocketAddress;
 import java.security.KeyPair;
 import java.security.PublicKey;
-import java.security.cert.X509Certificate;
 import java.security.spec.InvalidKeySpecException;
 import java.util.Arrays;
 import java.util.Collection;
@@ -31,7 +29,6 @@ import java.util.EnumSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.TreeMap;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -40,7 +37,6 @@ import org.apache.sshd.client.auth.hostbased.HostKeyIdentityProvider;
 import org.apache.sshd.client.auth.keyboard.UserInteraction;
 import org.apache.sshd.client.auth.password.PasswordIdentityProvider;
 import org.apache.sshd.client.future.AuthFuture;
-import org.apache.sshd.client.keyverifier.ServerKeyVerifier;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.PropertyResolverUtils;
@@ -61,7 +57,6 @@ import org.apache.sshd.common.util.net.SshdSocketAddress;
 import org.apache.sshd.server.ServerAuthenticationManager;
 import org.apache.sshd.server.ServerFactoryManager;
 import org.apache.sshd.server.SshServer;
-import org.apache.sshd.server.auth.hostbased.HostBasedAuthenticator;
 import org.apache.sshd.server.auth.keyboard.DefaultKeyboardInteractiveAuthenticator;
 import org.apache.sshd.server.auth.keyboard.InteractiveChallenge;
 import org.apache.sshd.server.auth.keyboard.KeyboardInteractiveAuthenticator;
@@ -158,16 +153,12 @@ public class AuthenticationTest extends BaseTestSupport {
     public void testChangePassword() throws Exception {
         final PasswordAuthenticator delegate = sshd.getPasswordAuthenticator();
         final AtomicInteger attemptsCount = new AtomicInteger(0);
-        sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
-            @Override
-            public boolean authenticate(String username, String password, ServerSession session)
-                    throws PasswordChangeRequiredException {
-                if (attemptsCount.incrementAndGet() == 1) {
-                    throw new PasswordChangeRequiredException(attemptsCount.toString(), getCurrentTestName(), ServerAuthenticationManager.DEFAULT_WELCOME_BANNER_LANGUAGE);
-                }
-
-                return delegate.authenticate(username, password, session);
+        sshd.setPasswordAuthenticator((username, password, session) -> {
+            if (attemptsCount.incrementAndGet() == 1) {
+                throw new PasswordChangeRequiredException(attemptsCount.toString(), getCurrentTestName(), ServerAuthenticationManager.DEFAULT_WELCOME_BANNER_LANGUAGE);
             }
+
+            return delegate.authenticate(username, password, session);
         });
 
         final AtomicInteger changesCount = new AtomicInteger(0);
@@ -383,15 +374,11 @@ public class AuthenticationTest extends BaseTestSupport {
         challenge.setInteractionInstruction(anchor.getPackage().getName());
         challenge.setLanguageTag(Locale.getDefault().getLanguage());
 
-        final Map<String, String> rspMap = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER) {
-            private static final long serialVersionUID = 1L;    // we're not serializing it
-
-            {
-                put("class", anchor.getSimpleName());
-                put("package", anchor.getPackage().getName());
-                put("test", getCurrentTestName());
-            }
-        };
+        final Map<String, String> rspMap = GenericUtils.<String, String>mapBuilder(String.CASE_INSENSITIVE_ORDER)
+                .put("class", anchor.getSimpleName())
+                .put("package", anchor.getPackage().getName())
+                .put("test", getCurrentTestName())
+                .build();
         for (String prompt : rspMap.keySet()) {
             challenge.addPrompt(prompt, (GenericUtils.size(challenge.getPrompts()) & 0x1) != 0);
         }
@@ -478,16 +465,12 @@ public class AuthenticationTest extends BaseTestSupport {
     public void testAuthPasswordChangeRequest() throws Exception {
         final PasswordAuthenticator delegate = ValidateUtils.checkNotNull(sshd.getPasswordAuthenticator(), "No password authenticator");
         final AtomicInteger attemptsCount = new AtomicInteger(0);
-        sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
-            @Override
-            public boolean authenticate(String username, String password, ServerSession session)
-                    throws PasswordChangeRequiredException {
-                if (attemptsCount.incrementAndGet() == 1) {
-                    throw new PasswordChangeRequiredException(attemptsCount.toString(), getCurrentTestName(), ServerAuthenticationManager.DEFAULT_WELCOME_BANNER_LANGUAGE);
-                }
-
-                return delegate.authenticate(username, password, session);
+        sshd.setPasswordAuthenticator((username, password, session) -> {
+            if (attemptsCount.incrementAndGet() == 1) {
+                throw new PasswordChangeRequiredException(attemptsCount.toString(), getCurrentTestName(), ServerAuthenticationManager.DEFAULT_WELCOME_BANNER_LANGUAGE);
             }
+
+            return delegate.authenticate(username, password, session);
         });
         PropertyResolverUtils.updateProperty(sshd, ServerAuthenticationManager.AUTH_METHODS, UserAuthPasswordFactory.NAME);
 
@@ -564,13 +547,10 @@ public class AuthenticationTest extends BaseTestSupport {
         try (SshClient client = setupTestClient()) {
             final List<String> passwords = Collections.singletonList(getCurrentTestName());
             final AtomicInteger loadCount = new AtomicInteger(0);
-            PasswordIdentityProvider provider = new PasswordIdentityProvider() {
-                @Override
-                public Iterable<String> loadPasswords() {
-                    loadCount.incrementAndGet();
-                    outputDebugMessage("loadPasswords - count=%s", loadCount);
-                    return passwords;
-                }
+            PasswordIdentityProvider provider = () -> {
+                loadCount.incrementAndGet();
+                outputDebugMessage("loadPasswords - count=%s", loadCount);
+                return passwords;
             };
             client.setPasswordIdentityProvider(provider);
 
@@ -587,7 +567,7 @@ public class AuthenticationTest extends BaseTestSupport {
 
     @Test   // see SSHD-618
     public void testPublicKeyAuthDifferentThanKex() throws Exception {
-        final KeyPairProvider serverKeys = KeyPairProvider.Utils.wrap(
+        final KeyPairProvider serverKeys = KeyPairProvider.wrap(
                     Utils.generateKeyPair(KeyUtils.RSA_ALGORITHM, 1024),
                     Utils.generateKeyPair(KeyUtils.DSS_ALGORITHM, 512),
                     Utils.generateKeyPair(KeyUtils.EC_ALGORITHM, 256));
@@ -596,32 +576,26 @@ public class AuthenticationTest extends BaseTestSupport {
         sshd.setPasswordAuthenticator(RejectAllPasswordAuthenticator.INSTANCE);
 
         final KeyPair clientIdentity = Utils.generateKeyPair(KeyUtils.EC_ALGORITHM, 256);
-        sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
-            @Override
-            public boolean authenticate(String username, PublicKey key, ServerSession session) {
-                String keyType = KeyUtils.getKeyType(key);
-                String expType = KeyUtils.getKeyType(clientIdentity);
-                assertEquals("Mismatched client key types", expType, keyType);
-                assertKeyEquals("Mismatched authentication public keys", clientIdentity.getPublic(), key);
-                return true;
-            }
+        sshd.setPublickeyAuthenticator((username, key, session) -> {
+            String keyType = KeyUtils.getKeyType(key);
+            String expType = KeyUtils.getKeyType(clientIdentity);
+            assertEquals("Mismatched client key types", expType, keyType);
+            assertKeyEquals("Mismatched authentication public keys", clientIdentity.getPublic(), key);
+            return true;
         });
 
         try (SshClient client = setupTestClient()) {
             // force server to use only the RSA key
             final NamedFactory<Signature> kexSignature = BuiltinSignatures.rsa;
             client.setSignatureFactories(Collections.singletonList(kexSignature));
-            client.setServerKeyVerifier(new ServerKeyVerifier() {
-                @Override
-                public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
-                    String keyType = KeyUtils.getKeyType(serverKey);
-                    String expType = kexSignature.getName();
-                    assertEquals("Mismatched server key type", expType, keyType);
+            client.setServerKeyVerifier((sshClientSession, remoteAddress, serverKey) -> {
+                String keyType = KeyUtils.getKeyType(serverKey);
+                String expType = kexSignature.getName();
+                assertEquals("Mismatched server key type", expType, keyType);
 
-                    KeyPair kp = ValidateUtils.checkNotNull(serverKeys.loadKey(keyType), "No server key for type=%s", keyType);
-                    assertKeyEquals("Mismatched server public keys", kp.getPublic(), serverKey);
-                    return true;
-                }
+                KeyPair kp = ValidateUtils.checkNotNull(serverKeys.loadKey(keyType), "No server key for type=%s", keyType);
+                assertKeyEquals("Mismatched server public keys", kp.getPublic(), serverKey);
+                return true;
             });
 
             // allow only EC keys for public key authentication
@@ -702,15 +676,11 @@ public class AuthenticationTest extends BaseTestSupport {
         final String hostClientName = SshdSocketAddress.toAddressString(SshdSocketAddress.getFirstExternalNetwork4Address());
         final KeyPair hostClientKey = Utils.generateKeyPair(KeyUtils.RSA_ALGORITHM, 1024);
         final AtomicInteger invocationCount = new AtomicInteger(0);
-        sshd.setHostBasedAuthenticator(new HostBasedAuthenticator() {
-            @Override
-            public boolean authenticate(ServerSession session, String username,
-                    PublicKey clientHostKey, String clientHostName, String clientUsername, List<X509Certificate> certificates) {
-                invocationCount.incrementAndGet();
-                return hostClienUser.equals(clientUsername)
-                    && hostClientName.equals(clientHostName)
-                    && KeyUtils.compareKeys(hostClientKey.getPublic(), clientHostKey);
-            }
+        sshd.setHostBasedAuthenticator((session, username, clientHostKey, clientHostName, clientUsername, certificates) -> {
+            invocationCount.incrementAndGet();
+            return hostClienUser.equals(clientUsername)
+                && hostClientName.equals(clientHostName)
+                && KeyUtils.compareKeys(hostClientKey.getPublic(), clientHostKey);
         });
         sshd.setPasswordAuthenticator(RejectAllPasswordAuthenticator.INSTANCE);
         sshd.setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator.NONE);
@@ -724,7 +694,7 @@ public class AuthenticationTest extends BaseTestSupport {
                     new org.apache.sshd.client.auth.hostbased.UserAuthHostBasedFactory();
             // TODO factory.setClientHostname(CLIENT_HOSTNAME);
             factory.setClientUsername(hostClienUser);
-            factory.setClientHostKeys(HostKeyIdentityProvider.Utils.wrap(hostClientKey));
+            factory.setClientHostKeys(HostKeyIdentityProvider.wrap(hostClientKey));
 
             client.setUserAuthFactories(Collections.singletonList(factory));
             client.start();
@@ -742,29 +712,22 @@ public class AuthenticationTest extends BaseTestSupport {
         final Error thrown = new OutOfMemoryError(getCurrentTestName());
         final PasswordAuthenticator authPassword = sshd.getPasswordAuthenticator();
         final AtomicInteger passCounter = new AtomicInteger(0);
-        sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
-            @Override
-            public boolean authenticate(String username, String password, ServerSession session)
-                    throws PasswordChangeRequiredException {
-                int count = passCounter.incrementAndGet();
-                if (count == 1) {
-                    throw thrown;
-                }
-                return authPassword.authenticate(username, password, session);
+        sshd.setPasswordAuthenticator((username, password, session) -> {
+            int count = passCounter.incrementAndGet();
+            if (count == 1) {
+                throw thrown;
             }
+            return authPassword.authenticate(username, password, session);
         });
 
         final PublickeyAuthenticator authPubkey = sshd.getPublickeyAuthenticator();
         final AtomicInteger pubkeyCounter = new AtomicInteger(0);
-        sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
-            @Override
-            public boolean authenticate(String username, PublicKey key, ServerSession session) {
-                int count = pubkeyCounter.incrementAndGet();
-                if (count == 1) {
-                    throw thrown;
-                }
-                return authPubkey.authenticate(username, key, session);
+        sshd.setPublickeyAuthenticator((username, key, session) -> {
+            int count = pubkeyCounter.incrementAndGet();
+            if (count == 1) {
+                throw thrown;
             }
+            return authPubkey.authenticate(username, key, session);
         });
         sshd.setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator.NONE);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/auth/SinglePublicKeyAuthTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/auth/SinglePublicKeyAuthTest.java b/sshd-core/src/test/java/org/apache/sshd/common/auth/SinglePublicKeyAuthTest.java
index 96039bd..dc959e7 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/auth/SinglePublicKeyAuthTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/auth/SinglePublicKeyAuthTest.java
@@ -31,13 +31,13 @@ import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.config.keys.KeyUtils;
 import org.apache.sshd.common.keyprovider.KeyPairProvider;
+import org.apache.sshd.common.session.Session;
 import org.apache.sshd.server.ServerAuthenticationManager;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.auth.pubkey.CachingPublicKeyAuthenticator;
 import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
 import org.apache.sshd.server.auth.pubkey.UserAuthPublicKeyFactory;
 import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
-import org.apache.sshd.server.session.ServerSession;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.junit.After;
 import org.junit.Before;
@@ -69,13 +69,7 @@ public class SinglePublicKeyAuthTest extends BaseTestSupport {
     public void setUp() throws Exception {
         sshd = setupTestServer();
         PropertyResolverUtils.updateProperty(sshd, ServerAuthenticationManager.AUTH_METHODS, UserAuthPublicKeyFactory.NAME);
-        sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public boolean authenticate(String username, PublicKey key, ServerSession session) {
-                return delegate.authenticate(username, key, session);
-            }
-        });
+        sshd.setPublickeyAuthenticator((username, key, session) -> delegate.authenticate(username, key, session));
         sshd.start();
         port = sshd.getPort();
     }
@@ -89,16 +83,12 @@ public class SinglePublicKeyAuthTest extends BaseTestSupport {
 
     @Test
     public void testPublicKeyAuthWithCache() throws Exception {
-        final ConcurrentHashMap<String, AtomicInteger> count = new ConcurrentHashMap<String, AtomicInteger>();
-        TestCachingPublicKeyAuthenticator auth = new TestCachingPublicKeyAuthenticator(new PublickeyAuthenticator() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public boolean authenticate(String username, PublicKey key, ServerSession session) {
-                String fp = KeyUtils.getFingerPrint(key);
-                count.putIfAbsent(fp, new AtomicInteger());
-                count.get(fp).incrementAndGet();
-                return key.equals(pairRsa.getPublic());
-            }
+        final ConcurrentHashMap<String, AtomicInteger> count = new ConcurrentHashMap<>();
+        TestCachingPublicKeyAuthenticator auth = new TestCachingPublicKeyAuthenticator((username, key, session) -> {
+            String fp = KeyUtils.getFingerPrint(key);
+            count.putIfAbsent(fp, new AtomicInteger());
+            count.get(fp).incrementAndGet();
+            return key.equals(pairRsa.getPublic());
         });
         delegate = auth;
 
@@ -129,16 +119,12 @@ public class SinglePublicKeyAuthTest extends BaseTestSupport {
 
     @Test
     public void testPublicKeyAuthWithoutCache() throws Exception {
-        final ConcurrentHashMap<String, AtomicInteger> count = new ConcurrentHashMap<String, AtomicInteger>();
-        delegate = new PublickeyAuthenticator() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public boolean authenticate(String username, PublicKey key, ServerSession session) {
-                String fp = KeyUtils.getFingerPrint(key);
-                count.putIfAbsent(fp, new AtomicInteger());
-                count.get(fp).incrementAndGet();
-                return key.equals(pairRsa.getPublic());
-            }
+        final ConcurrentHashMap<String, AtomicInteger> count = new ConcurrentHashMap<>();
+        delegate = (username, key, session) -> {
+            String fp = KeyUtils.getFingerPrint(key);
+            count.putIfAbsent(fp, new AtomicInteger());
+            count.get(fp).incrementAndGet();
+            return key.equals(pairRsa.getPublic());
         };
 
         try (SshClient client = setupTestClient()) {
@@ -174,7 +160,7 @@ public class SinglePublicKeyAuthTest extends BaseTestSupport {
             super(authenticator);
         }
 
-        public Map<ServerSession, Map<PublicKey, Boolean>> getCache() {
+        public Map<Session, Map<PublicKey, Boolean>> getCache() {
             return cache;
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java
index 6e2cae7..e8d3df8 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedOutputStreamTest.java
@@ -30,8 +30,6 @@ import org.junit.Test;
 import org.junit.runners.MethodSorters;
 import org.mockito.Matchers;
 import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
@@ -46,23 +44,17 @@ public class ChannelPipedOutputStreamTest extends BaseTestSupport {
     public void testNioChannelImplementation() throws IOException {
         ChannelPipedSink sink = Mockito.mock(ChannelPipedSink.class);
         final AtomicBoolean eofCalled = new AtomicBoolean(false);
-        Mockito.doAnswer(new Answer<Void>() {
-            @Override
-            public Void answer(InvocationOnMock invocation) throws Throwable {
-                assertFalse("Multiple EOF calls", eofCalled.getAndSet(true));
-                return null;
-            }
+        Mockito.doAnswer(invocation -> {
+            assertFalse("Multiple EOF calls", eofCalled.getAndSet(true));
+            return null;
         }).when(sink).eof();
 
 
         final AtomicInteger receiveCount = new AtomicInteger(0);
-        Mockito.doAnswer(new Answer<Void>() {
-            @Override
-            public Void answer(InvocationOnMock invocation) throws Throwable {
-                Number len = invocation.getArgumentAt(2, Number.class);
-                receiveCount.addAndGet(len.intValue());
-                return null;
-            }
+        Mockito.doAnswer(invocation -> {
+            Number len = invocation.getArgumentAt(2, Number.class);
+            receiveCount.addAndGet(len.intValue());
+            return null;
         }).when(sink).receive(Matchers.any(byte[].class), Matchers.anyInt(), Matchers.anyInt());
         try (ChannelPipedOutputStream stream = new ChannelPipedOutputStream(sink)) {
             assertTrue("Stream not marked as initially open", stream.isOpen());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
index e19c0bb..5620fae 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
@@ -342,9 +342,7 @@ public class WindowTest extends BaseTestSupport {
 
         @Override
         public void destroy() {
-            if (LATCH != null) {
-                LATCH.countDown();
-            }
+            LATCH.countDown();
             super.destroy();
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java b/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
index 7d74d81..cbb80ca 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
@@ -170,7 +170,7 @@ public class BuiltinCiphersTest extends BaseTestSupport {
 
     private static <M extends FactoryManager> M testSupportedCiphersConfiguration(M manager) {
         Collection<? extends NamedResource> factories = manager.getCipherFactories();
-        List<String> names = NamedResource.Utils.getNameList(factories);
+        List<String> names = NamedResource.getNameList(factories);
         for (BuiltinCiphers c : BuiltinCiphers.VALUES) {
             if (BuiltinCiphers.none.equals(c)) {
                 continue;   // not always included by default + it is a dummy cipher
@@ -200,14 +200,14 @@ public class BuiltinCiphersTest extends BaseTestSupport {
 
     @Test
     public void testParseCiphersList() {
-        List<String> builtin = NamedResource.Utils.getNameList(BuiltinCiphers.VALUES);
+        List<String> builtin = NamedResource.getNameList(BuiltinCiphers.VALUES);
         List<String> unknown = Arrays.asList(getClass().getPackage().getName(), getClass().getSimpleName(), getCurrentTestName());
         Random rnd = new Random();
         for (int index = 0; index < (builtin.size() + unknown.size()); index++) {
             Collections.shuffle(builtin, rnd);
             Collections.shuffle(unknown, rnd);
 
-            List<String> weavedList = new ArrayList<String>(builtin.size() + unknown.size());
+            List<String> weavedList = new ArrayList<>(builtin.size() + unknown.size());
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
@@ -225,7 +225,7 @@ public class BuiltinCiphersTest extends BaseTestSupport {
 
             String fullList = GenericUtils.join(weavedList, ',');
             ParseResult result = BuiltinCiphers.parseCiphersList(fullList);
-            List<String> parsed = NamedResource.Utils.getNameList(result.getParsedFactories());
+            List<String> parsed = NamedResource.getNameList(result.getParsedFactories());
             List<String> missing = result.getUnsupportedFactories();
 
             // makes sure not only that the contents are the same but also the order

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java b/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
index c5a76a3..c4b5701 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
@@ -21,14 +21,14 @@ package org.apache.sshd.common.cipher;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import com.jcraft.jsch.JSch;
-
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.NamedResource;
 import org.apache.sshd.common.channel.Channel;
@@ -57,7 +57,7 @@ import org.junit.runners.Parameterized.Parameters;
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 @RunWith(Parameterized.class)   // see https://github.com/junit-team/junit/wiki/Parameterized-tests
 public class CipherTest extends BaseTestSupport {
-    private static final Integer NUM_LOADTEST_ROUNDS = Integer.valueOf(100000);
+    private static final Integer NUM_LOADTEST_ROUNDS = 100000;
 
     /*
      * NOTE !!! order is important since we build from it the C2S/S2C ciphers proposal
@@ -75,19 +75,12 @@ public class CipherTest extends BaseTestSupport {
 
     @SuppressWarnings("synthetic-access")
     private static final List<NamedResource> TEST_CIPHERS =
-            Collections.unmodifiableList(new ArrayList<NamedResource>(PARAMETERS.size()) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    for (Object[] params : PARAMETERS) {
-                        add((NamedResource) params[0]);
-                    }
-
-                    add(BuiltinCiphers.none);
-                }
-            });
+            Collections.unmodifiableList(
+                    Stream.concat(PARAMETERS.stream().map(params -> (NamedResource) params[0]),
+                                  Stream.of(BuiltinCiphers.none))
+                          .collect(Collectors.toList()));
 
-    private static final String CRYPT_NAMES = NamedResource.Utils.getNames(TEST_CIPHERS);
+    private static final String CRYPT_NAMES = NamedResource.getNames(TEST_CIPHERS);
     private static SshServer sshd;
     private static int port;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
index a0a2828..a7e5247 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
@@ -76,14 +76,14 @@ public class BuiltinCompressionsTest extends BaseTestSupport {
 
     @Test
     public void testParseCompressionsList() {
-        List<String> builtin = NamedResource.Utils.getNameList(BuiltinCompressions.VALUES);
+        List<String> builtin = NamedResource.getNameList(BuiltinCompressions.VALUES);
         List<String> unknown = Arrays.asList(getClass().getPackage().getName(), getClass().getSimpleName(), getCurrentTestName());
         Random rnd = new Random();
         for (int index = 0; index < (builtin.size() + unknown.size()); index++) {
             Collections.shuffle(builtin, rnd);
             Collections.shuffle(unknown, rnd);
 
-            List<String> weavedList = new ArrayList<String>(builtin.size() + unknown.size());
+            List<String> weavedList = new ArrayList<>(builtin.size() + unknown.size());
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
@@ -101,7 +101,7 @@ public class BuiltinCompressionsTest extends BaseTestSupport {
 
             String fullList = GenericUtils.join(weavedList, ',');
             ParseResult result = BuiltinCompressions.parseCompressionsList(fullList);
-            List<String> parsed = NamedResource.Utils.getNameList(result.getParsedFactories());
+            List<String> parsed = NamedResource.getNameList(result.getParsedFactories());
             List<String> missing = result.getUnsupportedFactories();
 
             // makes sure not only that the contents are the same but also the order

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java b/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
index b2dec83..79a15e6 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
@@ -21,14 +21,12 @@ package org.apache.sshd.common.compression;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 
 import com.jcraft.jsch.JSch;
-
 import org.apache.sshd.common.channel.Channel;
 import org.apache.sshd.common.kex.KexProposalOption;
 import org.apache.sshd.common.mac.MacTest;
@@ -112,7 +110,7 @@ public class CompressionTest extends BaseTestSupport {
 
     @Before
     public void setUp() throws Exception {
-        sshd.setCompressionFactories(Arrays.asList(factory));
+        sshd.setCompressionFactories(Collections.singletonList(factory));
         sshd.addSessionListener(listener);
 
         String name = factory.getName();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/config/SshConfigFileReaderTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/config/SshConfigFileReaderTest.java b/sshd-core/src/test/java/org/apache/sshd/common/config/SshConfigFileReaderTest.java
index dddf907..e29153b 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/config/SshConfigFileReaderTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/config/SshConfigFileReaderTest.java
@@ -146,7 +146,7 @@ public class SshConfigFileReaderTest extends BaseTestSupport {
                 getCurrentTestName(),
                 false,
                 true);
-        fail("Unexpected success: " + NamedResource.Utils.getNames(manager.getCipherFactories()));
+        fail("Unexpected success: " + NamedResource.getNames(manager.getCipherFactories()));
     }
 
     @Test(expected = IllegalArgumentException.class)
@@ -161,7 +161,7 @@ public class SshConfigFileReaderTest extends BaseTestSupport {
                 getCurrentTestName(),
                 false,
                 true);
-        fail("Unexpected success: " + NamedResource.Utils.getNames(manager.getSignatureFactories()));
+        fail("Unexpected success: " + NamedResource.getNames(manager.getSignatureFactories()));
     }
 
     @Test(expected = IllegalArgumentException.class)
@@ -176,7 +176,7 @@ public class SshConfigFileReaderTest extends BaseTestSupport {
                 getCurrentTestName(),
                 false,
                 true);
-        fail("Unexpected success: " + NamedResource.Utils.getNames(manager.getMacFactories()));
+        fail("Unexpected success: " + NamedResource.getNames(manager.getMacFactories()));
     }
 
     @Test
@@ -285,7 +285,7 @@ public class SshConfigFileReaderTest extends BaseTestSupport {
     }
 
     private static <R extends NamedResource> Properties initNamedResourceProperties(String key, Collection<? extends R> values) {
-        return initProperties(key, NamedResource.Utils.getNames(values));
+        return initProperties(key, NamedResource.getNames(values));
     }
 
     private static Properties initProperties(String key, String value) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/config/TimeValueConfigTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/config/TimeValueConfigTest.java b/sshd-core/src/test/java/org/apache/sshd/common/config/TimeValueConfigTest.java
index 8856415..fbb09e7 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/config/TimeValueConfigTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/config/TimeValueConfigTest.java
@@ -38,11 +38,11 @@ public class TimeValueConfigTest extends BaseTestSupport {
     @Test
     public void testDurationOf() {
         Object[] values = {
-            "600", Long.valueOf(TimeUnit.SECONDS.toMillis(600L)),
-            "10m", Long.valueOf(TimeUnit.MINUTES.toMillis(10L)),
-            "1h30m", Long.valueOf(TimeUnit.MINUTES.toMillis(90L)),
-            "2d", Long.valueOf(TimeUnit.DAYS.toMillis(2L)),
-            "3w", Long.valueOf(TimeUnit.DAYS.toMillis(3L * 7L))
+            "600", TimeUnit.SECONDS.toMillis(600L),
+            "10m", TimeUnit.MINUTES.toMillis(10L),
+            "1h30m", TimeUnit.MINUTES.toMillis(90L),
+            "2d", TimeUnit.DAYS.toMillis(2L),
+            "3w", TimeUnit.DAYS.toMillis(3L * 7L)
         };
         for (int index = 0; index < values.length; index += 2) {
             String s = (String) values[index];

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java
index 5a7e2b4..2488b14 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java
@@ -96,7 +96,7 @@ public abstract class AuthorizedKeysTestSupport extends BaseTestSupport {
     }
 
     public static List<String> loadSupportedKeys(BufferedReader rdr) throws IOException {
-        List<String> keyLines = new ArrayList<String>();
+        List<String> keyLines = new ArrayList<>();
         boolean eccSupported = SecurityUtils.hasEcc();
         for (String l = rdr.readLine(); l != null; l = rdr.readLine()) {
             l = GenericUtils.trimToEmpty(l);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyRandomArtTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyRandomArtTest.java b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyRandomArtTest.java
index a0c472c..c7083cb 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyRandomArtTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyRandomArtTest.java
@@ -26,7 +26,6 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.sshd.common.cipher.ECCurves;
-import org.apache.sshd.common.keyprovider.KeyIdentityProvider;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.Utils;
@@ -74,13 +73,7 @@ public class KeyRandomArtTest extends BaseTestSupport {
 
     @AfterClass
     public static void dumpAllArts() throws Exception {
-        KeyRandomArt.combine(System.out, ' ', new KeyIdentityProvider() {
-            @Override
-            @SuppressWarnings("synthetic-access")
-            public Iterable<KeyPair> loadKeys() {
-                return KEYS;
-            }
-        });
+        KeyRandomArt.combine(System.out, ' ', () -> KEYS);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintCaseSensitivityTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintCaseSensitivityTest.java b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintCaseSensitivityTest.java
index 82b61b6..a100aa9 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintCaseSensitivityTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintCaseSensitivityTest.java
@@ -85,6 +85,6 @@ public class KeyUtilsFingerprintCaseSensitivityTest extends BaseTestSupport {
 
     @Test
     public void testCase() throws Exception {
-        assertEquals("Check failed", new Pair<Boolean, String>(true, expected), KeyUtils.checkFingerPrint(test, key));
+        assertEquals("Check failed", new Pair<>(true, expected), KeyUtils.checkFingerPrint(test, key));
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintGenerationTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintGenerationTest.java b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintGenerationTest.java
index 1de26f4..b360cb7 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintGenerationTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsFingerprintGenerationTest.java
@@ -140,12 +140,12 @@ public class KeyUtilsFingerprintGenerationTest extends BaseTestSupport {
         );
         assertEquals(
             String.format("Fingerprint check failed for digest %s", name),
-            new Pair<Boolean, String>(true, expected),
+                new Pair<>(true, expected),
             KeyUtils.checkFingerPrint(expected, digestFactory, key)
         );
         assertEquals(
             String.format("Fingerprint check succeeded for invalid digest %s", name),
-            new Pair<Boolean, String>(false, expected),
+                new Pair<>(false, expected),
             KeyUtils.checkFingerPrint(expected + "A", digestFactory, key)
         );
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsTest.java
index 355358d..4b9b465 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/KeyUtilsTest.java
@@ -63,7 +63,7 @@ public class KeyUtilsTest extends BaseTestSupport {
     public void testGenerateRSAKeyPairs() throws GeneralSecurityException {
         GeneralSecurityException err = null;
         for (Integer size : RSA_SIZES) {
-            int keySize = size.intValue();
+            int keySize = size;
             try {
                 KeyPair kp = generateKeyPair(KeyPairProvider.SSH_RSA, keySize);
                 testKeyPairCloning(KeyPairProvider.SSH_RSA, keySize, kp);
@@ -81,7 +81,7 @@ public class KeyUtilsTest extends BaseTestSupport {
     public void testGenerateDSSKeyPairs() throws GeneralSecurityException {
         GeneralSecurityException err = null;
         for (Integer size : DSS_SIZES) {
-            int keySize = size.intValue();
+            int keySize = size;
             try {
                 KeyPair kp = generateKeyPair(KeyPairProvider.SSH_DSS, keySize);
                 testKeyPairCloning(KeyPairProvider.SSH_DSS, keySize, kp);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java b/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
index be95fcf..c342ea6 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
@@ -304,13 +304,7 @@ public class RootedFileSystemProviderTest extends AssertableFile {
         }
 
         public static DirectoryStream<Path> readDirectory(Path dir) throws InvalidPathException, IOException {
-            DirectoryStream<Path> dirStream = fileSystem.provider().newDirectoryStream(dir,
-                    new DirectoryStream.Filter<Path>() {
-                        @Override
-                        public boolean accept(Path entry) throws IOException {
-                            return true;
-                        }
-                    });
+            DirectoryStream<Path> dirStream = fileSystem.provider().newDirectoryStream(dir, entry -> true);
             return dirStream;
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
index c788596..625f71d 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
@@ -39,7 +39,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.Session;
-
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpVersion;
@@ -237,7 +236,7 @@ public class PortForwardingLoadTest extends BaseTestSupport {
                                     }
                                 }
                             }
-                            log.info("Finished iteration {}", Integer.valueOf(i));
+                            log.info("Finished iteration {}", i);
                             iterationsSignal.release();
                         }
                         log.info("Done");
@@ -252,7 +251,7 @@ public class PortForwardingLoadTest extends BaseTestSupport {
             byte[] buf = new byte[8192];
             byte[] bytes = payload.getBytes(StandardCharsets.UTF_8);
             for (int i = 0; i < numIterations; i++) {
-                log.info("Iteration {}", Integer.valueOf(i));
+                log.info("Iteration {}", i);
                 try (Socket s = new Socket(TEST_LOCALHOST, sinkPort);
                      OutputStream sockOut = s.getOutputStream()) {
 
@@ -463,8 +462,8 @@ public class PortForwardingLoadTest extends BaseTestSupport {
                     }
                 };
             }
-            for (int i = 0; i < threads.length; i++) {
-                threads[i].start();
+            for (Thread thread : threads) {
+                thread.start();
             }
             latch.await();
             for (Throwable t : errors) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingTest.java b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingTest.java
index cba1951..a0f28f5 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingTest.java
@@ -32,7 +32,6 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeMap;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.TimeUnit;
@@ -42,7 +41,6 @@ import java.util.concurrent.atomic.AtomicReference;
 import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.Session;
-
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.core.service.IoAcceptor;
 import org.apache.mina.core.service.IoHandlerAdapter;
@@ -166,14 +164,11 @@ public class PortForwardingTest extends BaseTestSupport {
         final TcpipForwarderFactory factory = ValidateUtils.checkNotNull(sshd.getTcpipForwarderFactory(), "No TcpipForwarderFactory");
         sshd.setTcpipForwarderFactory(new TcpipForwarderFactory() {
             private final Class<?>[] interfaces = {TcpipForwarder.class};
-            private final Map<String, String> method2req = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it...
-
-                {
-                    put("localPortForwardingRequested", TcpipForwardHandler.REQUEST);
-                    put("localPortForwardingCancelled", CancelTcpipForwardHandler.REQUEST);
-                }
-            };
+            private final Map<String, String> method2req =
+                    GenericUtils.<String, String>mapBuilder(String.CASE_INSENSITIVE_ORDER)
+                        .put("localPortForwardingRequested", TcpipForwardHandler.REQUEST)
+                        .put("localPortForwardingCancelled", CancelTcpipForwardHandler.REQUEST)
+                        .build();
 
             @Override
             public TcpipForwarder create(ConnectionService service) {
@@ -773,16 +768,16 @@ public class PortForwardingTest extends BaseTestSupport {
                 return false;
             }
             // does it have 'org.apache.sshd.server.session.TcpipForwardSupport.close'?
-            for (int i = 0; i < stack.length; ++i) {
-                String clazzName = stack[i].getClassName();
-                String methodName = stack[i].getMethodName();
+            for (StackTraceElement aStack : stack) {
+                String clazzName = aStack.getClassName();
+                String methodName = aStack.getMethodName();
                 // log.debug("Class: " + clazzName);
                 // log.debug("Method: " + methodName);
                 if (clazzName.equals("org.apache.sshd.server.session.TcpipForwardSupport")
                         && (methodName.equals("close") || methodName.equals("sessionCreated"))) {
                     log.warn(thread.getName() + " stuck at " + clazzName
-                           + "." + methodName + ": "
-                           + stack[i].getLineNumber());
+                            + "." + methodName + ": "
+                            + aStack.getLineNumber());
                     return true;
                 }
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/future/DefaultSshFutureTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/future/DefaultSshFutureTest.java b/sshd-core/src/test/java/org/apache/sshd/common/future/DefaultSshFutureTest.java
index 35a9e63..4d3edb2 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/future/DefaultSshFutureTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/future/DefaultSshFutureTest.java
@@ -62,13 +62,10 @@ public class DefaultSshFutureTest extends BaseTestSupport {
         final DefaultSshFuture future = new DefaultSshFuture(null);
         final AtomicInteger listenerCount = new AtomicInteger(0);
         final Object expected = new Object();
-        final SshFutureListener listener = new SshFutureListener() {
-            @Override
-            public void operationComplete(SshFuture f) {
-                assertSame("Mismatched future instance", future, f);
-                assertSame("Mismatched value object", expected, future.getValue());
-                listenerCount.incrementAndGet();
-            }
+        final SshFutureListener listener = f -> {
+            assertSame("Mismatched future instance", future, f);
+            assertSame("Mismatched value object", expected, future.getValue());
+            listenerCount.incrementAndGet();
         };
 
         final int numListeners = Byte.SIZE;
@@ -86,13 +83,10 @@ public class DefaultSshFutureTest extends BaseTestSupport {
         final DefaultSshFuture future = new DefaultSshFuture(null);
         final AtomicInteger listenerCount = new AtomicInteger(0);
         final Object expected = new Object();
-        final SshFutureListener listener = new SshFutureListener() {
-            @Override
-            public void operationComplete(SshFuture f) {
-                assertSame("Mismatched future instance", future, f);
-                assertSame("Mismatched value object", expected, future.getValue());
-                listenerCount.incrementAndGet();
-            }
+        final SshFutureListener listener = f -> {
+            assertSame("Mismatched future instance", future, f);
+            assertSame("Mismatched value object", expected, future.getValue());
+            listenerCount.incrementAndGet();
         };
         future.setValue(expected);
 
@@ -123,13 +117,10 @@ public class DefaultSshFutureTest extends BaseTestSupport {
         final DefaultSshFuture future = new DefaultSshFuture(null);
         final AtomicInteger listenerCount = new AtomicInteger(0);
         final Object expected = new Object();
-        final SshFutureListener listener = new SshFutureListener() {
-            @Override
-            public void operationComplete(SshFuture f) {
-                assertSame("Mismatched future instance", future, f);
-                assertSame("Mismatched value object", expected, future.getValue());
-                listenerCount.incrementAndGet();
-            }
+        final SshFutureListener listener = f -> {
+            assertSame("Mismatched future instance", future, f);
+            assertSame("Mismatched value object", expected, future.getValue());
+            listenerCount.incrementAndGet();
         };
         future.addListener(listener);
         future.setValue(expected);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java b/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
index 74a7804..211d3ae 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
@@ -71,14 +71,14 @@ public class BuiltinDHFactoriesTest extends BaseTestSupport {
 
     @Test
     public void testParseDHFactorysList() {
-        List<String> builtin = NamedResource.Utils.getNameList(BuiltinDHFactories.VALUES);
+        List<String> builtin = NamedResource.getNameList(BuiltinDHFactories.VALUES);
         List<String> unknown = Arrays.asList(getClass().getPackage().getName(), getClass().getSimpleName(), getCurrentTestName());
         Random rnd = new Random();
         for (int index = 0; index < (builtin.size() + unknown.size()); index++) {
             Collections.shuffle(builtin, rnd);
             Collections.shuffle(unknown, rnd);
 
-            List<String> weavedList = new ArrayList<String>(builtin.size() + unknown.size());
+            List<String> weavedList = new ArrayList<>(builtin.size() + unknown.size());
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
@@ -96,7 +96,7 @@ public class BuiltinDHFactoriesTest extends BaseTestSupport {
 
             String fullList = GenericUtils.join(weavedList, ',');
             ParseResult result = BuiltinDHFactories.parseDHFactoriesList(fullList);
-            List<String> parsed = NamedResource.Utils.getNameList(result.getParsedFactories());
+            List<String> parsed = NamedResource.getNameList(result.getParsedFactories());
             List<String> missing = result.getUnsupportedFactories();
 
             // makes sure not only that the contents are the same but also the order

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/kex/KexFactoryManagerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/kex/KexFactoryManagerTest.java b/sshd-core/src/test/java/org/apache/sshd/common/kex/KexFactoryManagerTest.java
index b2a9682..a439027 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/kex/KexFactoryManagerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/kex/KexFactoryManagerTest.java
@@ -52,7 +52,7 @@ public class KexFactoryManagerTest extends BaseTestSupport {
         KexFactoryManager manager = new TestKexFactoryManager();
         assertEquals("Mismatched empty factories name list", "", manager.getCompressionFactoriesNameList());
 
-        String expected = NamedResource.Utils.getNames(BuiltinCompressions.VALUES);
+        String expected = NamedResource.getNames(BuiltinCompressions.VALUES);
         manager.setCompressionFactoriesNameList(expected);
         assertEquals("Mismatched updated factories name list", expected, manager.getCompressionFactoriesNameList());
 
@@ -69,7 +69,7 @@ public class KexFactoryManagerTest extends BaseTestSupport {
         KexFactoryManager manager = new TestKexFactoryManager();
         assertEquals("Mismatched empty factories name list", "", manager.getCipherFactoriesNameList());
 
-        String expected = NamedResource.Utils.getNames(BuiltinCiphers.VALUES);
+        String expected = NamedResource.getNames(BuiltinCiphers.VALUES);
         manager.setCipherFactoriesNameList(expected);
         assertEquals("Mismatched updated factories name list", expected, manager.getCipherFactoriesNameList());
 
@@ -86,7 +86,7 @@ public class KexFactoryManagerTest extends BaseTestSupport {
         KexFactoryManager manager = new TestKexFactoryManager();
         assertEquals("Mismatched empty factories name list", "", manager.getMacFactoriesNameList());
 
-        String expected = NamedResource.Utils.getNames(BuiltinMacs.VALUES);
+        String expected = NamedResource.getNames(BuiltinMacs.VALUES);
         manager.setMacFactoriesNameList(expected);
         assertEquals("Mismatched updated factories name list", expected, manager.getMacFactoriesNameList());
 
@@ -103,7 +103,7 @@ public class KexFactoryManagerTest extends BaseTestSupport {
         KexFactoryManager manager = new TestKexFactoryManager();
         assertEquals("Mismatched empty factories name list", "", manager.getSignatureFactoriesNameList());
 
-        String expected = NamedResource.Utils.getNames(BuiltinSignatures.VALUES);
+        String expected = NamedResource.getNames(BuiltinSignatures.VALUES);
         manager.setSignatureFactoriesNameList(expected);
         assertEquals("Mismatched updated factories name list", expected, manager.getSignatureFactoriesNameList());
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java b/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java
index fa3c8ee..db7c408 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/kex/KeyExchangeTest.java
@@ -22,6 +22,7 @@ package org.apache.sshd.common.kex;
 import java.util.Map;
 
 import org.apache.sshd.common.SshConstants;
+import org.apache.sshd.common.kex.KeyExchange.Utils;
 import org.apache.sshd.common.util.Transformer;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.junit.FixMethodOrder;
@@ -39,22 +40,12 @@ public class KeyExchangeTest extends BaseTestSupport {
 
     @Test
     public void testSimpleKexOpcodeName() {
-        testKexOpcodeName(KeyExchange.Utils.SIMPLE_KEX_OPCODES_MAP, new Transformer<Integer, String>() {
-            @Override
-            public String transform(Integer cmd) {
-                return KeyExchange.Utils.getSimpleKexOpcodeName(cmd);
-            }
-        });
+        testKexOpcodeName(KeyExchange.SIMPLE_KEX_OPCODES_MAP, Utils::getSimpleKexOpcodeName);
     }
 
     @Test
     public void testGroupKexOpcodeName() {
-        testKexOpcodeName(KeyExchange.Utils.GROUP_KEX_OPCODES_MAP, new Transformer<Integer, String>() {
-            @Override
-            public String transform(Integer cmd) {
-                return KeyExchange.Utils.getGroupKexOpcodeName(cmd);
-            }
-        });
+        testKexOpcodeName(KeyExchange.GROUP_KEX_OPCODES_MAP, Utils::getGroupKexOpcodeName);
     }
 
     private static void testKexOpcodeName(Map<Integer, String> opsMap, Transformer<Integer, String> xformer) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/keyprovider/KeyPairProviderTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/keyprovider/KeyPairProviderTest.java b/sshd-core/src/test/java/org/apache/sshd/common/keyprovider/KeyPairProviderTest.java
index 73e3604..256c6f9 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/keyprovider/KeyPairProviderTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/keyprovider/KeyPairProviderTest.java
@@ -22,8 +22,9 @@ package org.apache.sshd.common.keyprovider;
 import java.security.KeyPair;
 import java.security.PrivateKey;
 import java.security.PublicKey;
+import java.util.Arrays;
 import java.util.Map;
-import java.util.TreeMap;
+import java.util.function.Function;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.util.test.BaseTestSupport;
@@ -57,15 +58,12 @@ public class KeyPairProviderTest extends BaseTestSupport {
         final PublicKey pubKey = Mockito.mock(PublicKey.class);
         final PrivateKey prvKey = Mockito.mock(PrivateKey.class);
         final String[] testKeys = {getCurrentTestName(), getClass().getSimpleName()};
-        Map<String, KeyPair> pairsMap = new TreeMap<String, KeyPair>(String.CASE_INSENSITIVE_ORDER) {
-            private static final long serialVersionUID = 1L;    // we're not serializing it
+        Map<String, KeyPair> pairsMap = GenericUtils.toSortedMap(
+            Arrays.asList(testKeys),
+            Function.identity(),
+            k -> new KeyPair(pubKey, prvKey),
+            String.CASE_INSENSITIVE_ORDER);
 
-            {
-                for (String keyType : testKeys) {
-                    put(keyType, new KeyPair(pubKey, prvKey));
-                }
-            }
-        };
         KeyPairProvider provider = MappedKeyPairProvider.MAP_TO_KEY_PAIR_PROVIDER.transform(pairsMap);
         assertEquals("Key types", pairsMap.keySet(), provider.getKeyTypes());
         assertEquals("Key pairs", pairsMap.values(), provider.loadKeys());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
index 7972b25..5b6577c 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
@@ -71,14 +71,14 @@ public class BuiltinMacsTest extends BaseTestSupport {
 
     @Test
     public void testParseMacsList() {
-        List<String> builtin = NamedResource.Utils.getNameList(BuiltinMacs.VALUES);
+        List<String> builtin = NamedResource.getNameList(BuiltinMacs.VALUES);
         List<String> unknown = Arrays.asList(getClass().getPackage().getName(), getClass().getSimpleName(), getCurrentTestName());
         Random rnd = new Random();
         for (int index = 0; index < (builtin.size() + unknown.size()); index++) {
             Collections.shuffle(builtin, rnd);
             Collections.shuffle(unknown, rnd);
 
-            List<String> weavedList = new ArrayList<String>(builtin.size() + unknown.size());
+            List<String> weavedList = new ArrayList<>(builtin.size() + unknown.size());
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
@@ -96,7 +96,7 @@ public class BuiltinMacsTest extends BaseTestSupport {
 
             String fullList = GenericUtils.join(weavedList, ',');
             ParseResult result = BuiltinMacs.parseMacsList(fullList);
-            List<String> parsed = NamedResource.Utils.getNameList(result.getParsedFactories());
+            List<String> parsed = NamedResource.getNameList(result.getParsedFactories());
             List<String> missing = result.getUnsupportedFactories();
 
             // makes sure not only that the contents are the same but also the order

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
index 86e74af..c4eb730 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
@@ -23,11 +23,9 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
-import java.util.TreeSet;
 import java.util.concurrent.TimeUnit;
 
 import com.jcraft.jsch.JSch;
@@ -62,18 +60,8 @@ import ch.ethz.ssh2.ConnectionInfo;
 @RunWith(Parameterized.class)   // see https://github.com/junit-team/junit/wiki/Parameterized-tests
 public class MacTest extends BaseTestSupport {
     private static final Collection<String> GANYMEDE_MACS =
-            Collections.unmodifiableSet(new TreeSet<String>(String.CASE_INSENSITIVE_ORDER) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    String[] macs = Connection.getAvailableMACs();
-                    if (GenericUtils.length(macs) > 0) {
-                        for (String m : macs) {
-                            add(m);
-                        }
-                    }
-                }
-            });
+            Collections.unmodifiableSet(
+                    GenericUtils.asSortedSet(String.CASE_INSENSITIVE_ORDER, Connection.getAvailableMACs()));
 
     private static SshServer sshd;
     private static int port;
@@ -144,7 +132,7 @@ public class MacTest extends BaseTestSupport {
 
     @Before
     public void setUp() throws Exception {
-        sshd.setMacFactories(Arrays.asList(factory));
+        sshd.setMacFactories(Collections.singletonList(factory));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java b/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java
index 6ece5e7..e4f8e3d 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java
@@ -99,18 +99,14 @@ public class ReservedSessionMessagesHandlerTest extends BaseTestSupport {
                 @Override
                 public void sessionEvent(final Session session, Event event) {
                     if (Event.Authenticated.equals(event)) {
-                        service.execute(new Runnable() {
-                            @SuppressWarnings("synthetic-access")
-                            @Override
-                            public void run() {
-                                try {
-                                    testReservedSessionMessagesHandler(session, handler);
-                                    outputDebugMessage("Release test signal for %s", session);
-                                    signal.release();
-                                } catch (Throwable t) {
-                                    outputDebugMessage("Failed (%s) to run test: %s", t.getClass().getSimpleName(), t.getMessage());
-                                    session.exceptionCaught(t);
-                                }
+                        service.execute(() -> {
+                            try {
+                                testReservedSessionMessagesHandler(session, handler);
+                                outputDebugMessage("Release test signal for %s", session);
+                                signal.release();
+                            } catch (Throwable t) {
+                                outputDebugMessage("Failed (%s) to run test: %s", t.getClass().getSimpleName(), t.getMessage());
+                                session.exceptionCaught(t);
                             }
                         });
                     }
@@ -172,7 +168,7 @@ public class ReservedSessionMessagesHandlerTest extends BaseTestSupport {
             sb.setLength(sbLen);
             sb.append(index);
 
-            Pair<String, Boolean> entry = new Pair<>(sb.toString(), Boolean.valueOf((index & 0x01) == 0));
+            Pair<String, Boolean> entry = new Pair<>(sb.toString(), (index & 0x01) == 0);
             expected.add(entry);
             session.sendDebugMessage(entry.getValue(), entry.getKey(), null);
         }
@@ -225,7 +221,7 @@ public class ReservedSessionMessagesHandlerTest extends BaseTestSupport {
 
         @Override
         public void handleDebugMessage(Session session, boolean display, String msg, String lang, Buffer buffer) throws Exception {
-            debugMessages.add(new Pair<>(msg, Boolean.valueOf(display)));
+            debugMessages.add(new Pair<>(msg, display));
             super.handleDebugMessage(session, display, msg, lang, buffer);
             debugSignal.release();
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/session/helpers/AbstractSessionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/session/helpers/AbstractSessionTest.java b/sshd-core/src/test/java/org/apache/sshd/common/session/helpers/AbstractSessionTest.java
index 41622ca..b0f4a89 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/session/helpers/AbstractSessionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/session/helpers/AbstractSessionTest.java
@@ -127,9 +127,8 @@ public class AbstractSessionTest extends BaseTestSupport {
 
     @Test(expected = IllegalStateException.class)
     public void testReadIdentWithNullChar() {
-        StringBuilder sb = new StringBuilder(Session.MAX_VERSION_LINE_LENGTH + Integer.SIZE);
-        sb.append("SSH-2.0").append('\0').append("-software\r\n");
-        Buffer buf = new ByteArrayBuffer(sb.toString().getBytes(StandardCharsets.UTF_8));
+        String id = "SSH-2.0" + '\0' + "-software\r\n";
+        Buffer buf = new ByteArrayBuffer(id.getBytes(StandardCharsets.UTF_8));
         String ident = readIdentification(session, buf);
         fail("Unexpected success: " + ident);
     }
@@ -185,12 +184,9 @@ public class AbstractSessionTest extends BaseTestSupport {
     @Test   // see SSHD-652
     public void testCloseFutureListenerRegistration() throws Exception {
         final AtomicInteger closeCount = new AtomicInteger();
-        session.addCloseFutureListener(new SshFutureListener<CloseFuture>() {
-            @Override
-            public void operationComplete(CloseFuture future) {
-                assertTrue("Future not marted as closed", future.isClosed());
-                assertEquals("Unexpected multiple call to callback", 1, closeCount.incrementAndGet());
-            }
+        session.addCloseFutureListener(future -> {
+            assertTrue("Future not marted as closed", future.isClosed());
+            assertEquals("Unexpected multiple call to callback", 1, closeCount.incrementAndGet());
         });
         session.close();
         assertEquals("Close listener not called", 1, closeCount.get());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java b/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
index 356846c..dde8d10 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
@@ -54,14 +54,14 @@ public class BuiltinSignaturesTest extends BaseTestSupport {
 
     @Test
     public void testParseSignaturesList() {
-        List<String> builtin = NamedResource.Utils.getNameList(BuiltinSignatures.VALUES);
+        List<String> builtin = NamedResource.getNameList(BuiltinSignatures.VALUES);
         List<String> unknown = Arrays.asList(getClass().getPackage().getName(), getClass().getSimpleName(), getCurrentTestName());
         Random rnd = new Random();
         for (int index = 0; index < (builtin.size() + unknown.size()); index++) {
             Collections.shuffle(builtin, rnd);
             Collections.shuffle(unknown, rnd);
 
-            List<String> weavedList = new ArrayList<String>(builtin.size() + unknown.size());
+            List<String> weavedList = new ArrayList<>(builtin.size() + unknown.size());
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
@@ -79,7 +79,7 @@ public class BuiltinSignaturesTest extends BaseTestSupport {
 
             String fullList = GenericUtils.join(weavedList, ',');
             ParseResult result = BuiltinSignatures.parseSignatureList(fullList);
-            List<String> parsed = NamedResource.Utils.getNameList(result.getParsedFactories());
+            List<String> parsed = NamedResource.getNameList(result.getParsedFactories());
             List<String> missing = result.getUnsupportedFactories();
 
             // makes sure not only that the contents are the same but also the order


[12/16] mina-sshd git commit: [SSHD-698] Use lambda and method references, streams Deprecate Utils inner classes and use interface methods instead.

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/Buffer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/Buffer.java b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/Buffer.java
index b040853..5da403c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/Buffer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/Buffer.java
@@ -284,7 +284,7 @@ public abstract class Buffer implements Readable {
     }
 
     public PublicKey getPublicKey() throws SshException {
-        return getPublicKey(BufferPublicKeyParser.Utils.DEFAULT);
+        return getPublicKey(BufferPublicKeyParser.DEFAULT);
     }
 
     /**
@@ -306,7 +306,7 @@ public abstract class Buffer implements Readable {
     }
 
     public PublicKey getRawPublicKey() throws SshException {
-        return getRawPublicKey(BufferPublicKeyParser.Utils.DEFAULT);
+        return getRawPublicKey(BufferPublicKeyParser.DEFAULT);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
index ab62c0e..3f8ee1e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
@@ -48,12 +48,7 @@ public final class BufferUtils {
     public static final Level DEFAULT_HEXDUMP_LEVEL = Level.FINEST;
 
     public static final Int2IntFunction DEFAULT_BUFFER_GROWTH_FACTOR =
-        new Int2IntFunction() {
-            @Override
-            public int apply(int value) {
-                return getNextPowerOf2(value);
-            }
-        };
+            BufferUtils::getNextPowerOf2;
 
     /**
      * Private Constructor

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/BufferPublicKeyParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/BufferPublicKeyParser.java b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/BufferPublicKeyParser.java
index bcd3173..6d05868 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/BufferPublicKeyParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/BufferPublicKeyParser.java
@@ -35,6 +35,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public interface BufferPublicKeyParser<PUB extends PublicKey> {
+
     BufferPublicKeyParser<PublicKey> EMPTY = new BufferPublicKeyParser<PublicKey>() {
         @Override
         public boolean isKeyTypeSupported(String keyType) {
@@ -52,6 +53,12 @@ public interface BufferPublicKeyParser<PUB extends PublicKey> {
         }
     };
 
+    BufferPublicKeyParser<PublicKey> DEFAULT = aggregate(
+            Arrays.asList(
+                    RSABufferPublicKeyParser.INSTANCE,
+                    DSSBufferPublicKeyParser.INSTANCE,
+                    ECBufferPublicKeyParser.INSTANCE));
+
     /**
      * @param keyType The key type - e.g., &quot;ssh-rsa&quot, &quot;ssh-dss&quot;
      * @return {@code true} if this key type is supported by the parser
@@ -71,51 +78,53 @@ public interface BufferPublicKeyParser<PUB extends PublicKey> {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
-        public static final BufferPublicKeyParser<PublicKey> DEFAULT = aggregate(
-                Arrays.asList(
-                        RSABufferPublicKeyParser.INSTANCE,
-                        DSSBufferPublicKeyParser.INSTANCE,
-                        ECBufferPublicKeyParser.INSTANCE));
+
+        public static final BufferPublicKeyParser<PublicKey> DEFAULT = BufferPublicKeyParser.DEFAULT;
 
         private Utils() {
             throw new UnsupportedOperationException("No instance");
         }
 
         public static BufferPublicKeyParser<PublicKey> aggregate(final Collection<? extends BufferPublicKeyParser<? extends PublicKey>> parsers) {
-            if (GenericUtils.isEmpty(parsers)) {
-                return EMPTY;
-            }
+            return BufferPublicKeyParser.aggregate(parsers);
+        }
+    }
 
-            return new BufferPublicKeyParser<PublicKey>() {
-                @Override
-                public boolean isKeyTypeSupported(String keyType) {
-                    for (BufferPublicKeyParser<? extends PublicKey> p : parsers) {
-                        if (p.isKeyTypeSupported(keyType)) {
-                            return true;
-                        }
-                    }
+    static BufferPublicKeyParser<PublicKey> aggregate(final Collection<? extends BufferPublicKeyParser<? extends PublicKey>> parsers) {
+        if (GenericUtils.isEmpty(parsers)) {
+            return EMPTY;
+        }
 
-                    return false;
+        return new BufferPublicKeyParser<PublicKey>() {
+            @Override
+            public boolean isKeyTypeSupported(String keyType) {
+                for (BufferPublicKeyParser<? extends PublicKey> p : parsers) {
+                    if (p.isKeyTypeSupported(keyType)) {
+                        return true;
+                    }
                 }
 
-                @Override
-                public PublicKey getRawPublicKey(String keyType, Buffer buffer) throws GeneralSecurityException {
-                    for (BufferPublicKeyParser<? extends PublicKey> p : parsers) {
-                        if (p.isKeyTypeSupported(keyType)) {
-                            return p.getRawPublicKey(keyType, buffer);
-                        }
-                    }
+                return false;
+            }
 
-                    throw new NoSuchAlgorithmException("No aggregate matcher for " + keyType);
+            @Override
+            public PublicKey getRawPublicKey(String keyType, Buffer buffer) throws GeneralSecurityException {
+                for (BufferPublicKeyParser<? extends PublicKey> p : parsers) {
+                    if (p.isKeyTypeSupported(keyType)) {
+                        return p.getRawPublicKey(keyType, buffer);
+                    }
                 }
 
-                @Override
-                public String toString() {
-                    return String.valueOf(parsers);
-                }
-            };
-        }
+                throw new NoSuchAlgorithmException("No aggregate matcher for " + keyType);
+            }
+
+            @Override
+            public String toString() {
+                return String.valueOf(parsers);
+            }
+        };
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractCloseable.java
index c3780cb..1c5d78f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractCloseable.java
@@ -95,15 +95,11 @@ public abstract class AbstractCloseable extends IoBaseCloseable {
                 preClose();
                 SshFuture<CloseFuture> grace = doCloseGracefully();
                 if (grace != null) {
-                    grace.addListener(new SshFutureListener<CloseFuture>() {
-                        @Override
-                        @SuppressWarnings("synthetic-access")
-                        public void operationComplete(CloseFuture future) {
-                            if (state.compareAndSet(State.Graceful, State.Immediate)) {
-                                doCloseImmediately();
-                                if (log.isDebugEnabled()) {
-                                    log.debug("close({}][Graceful] - operationComplete() closed", AbstractCloseable.this);
-                                }
+                    grace.addListener(future -> {
+                        if (state.compareAndSet(State.Graceful, State.Immediate)) {
+                            doCloseImmediately();
+                            if (log.isDebugEnabled()) {
+                                log.debug("close({}][Graceful] - operationComplete() closed", AbstractCloseable.this);
                             }
                         }
                     });

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractInnerCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractInnerCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractInnerCloseable.java
index d3a7087..949d04d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractInnerCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/AbstractInnerCloseable.java
@@ -20,7 +20,6 @@ package org.apache.sshd.common.util.closeable;
 
 import org.apache.sshd.common.Closeable;
 import org.apache.sshd.common.future.CloseFuture;
-import org.apache.sshd.common.future.SshFutureListener;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
@@ -44,12 +43,6 @@ public abstract class AbstractInnerCloseable extends AbstractCloseable {
 
     @Override
     protected void doCloseImmediately() {
-        getInnerCloseable().close(true).addListener(new SshFutureListener<CloseFuture>() {
-            @Override
-            @SuppressWarnings("synthetic-access")
-            public void operationComplete(CloseFuture future) {
-                AbstractInnerCloseable.super.doCloseImmediately();
-            }
-        });
+        getInnerCloseable().close(true).addListener(future -> AbstractInnerCloseable.super.doCloseImmediately());
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/CloseableUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/CloseableUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/CloseableUtils.java
index 4d5d885..2309c7d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/CloseableUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/CloseableUtils.java
@@ -19,31 +19,30 @@
 package org.apache.sshd.common.util.closeable;
 
 import java.io.IOException;
-import java.net.SocketTimeoutException;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.common.Closeable;
 import org.apache.sshd.common.PropertyResolver;
-import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.future.CloseFuture;
 
 /**
  * Utility class to help with {@link Closeable}s.
  *
+ * @deprecated Use Closeable static methods instead
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
+@Deprecated
 public final class CloseableUtils {
     /**
      * Timeout (milliseconds) for waiting on a {@link CloseFuture} to successfully
      * complete its action.
      * @see #DEFAULT_CLOSE_WAIT_TIMEOUT
      */
-    public static final String CLOSE_WAIT_TIMEOUT = "sshd-close-wait-time";
+    public static final String CLOSE_WAIT_TIMEOUT = Closeable.CLOSE_WAIT_TIMEOUT;
 
     /**
      * Default value for {@link #CLOSE_WAIT_TIMEOUT} if none specified
      */
-    public static final long DEFAULT_CLOSE_WAIT_TIMEOUT = TimeUnit.SECONDS.toMillis(15L);
+    public static final long DEFAULT_CLOSE_WAIT_TIMEOUT = Closeable.DEFAULT_CLOSE_WAIT_TIMEOUT;
 
     /**
      * Private Constructor
@@ -53,22 +52,10 @@ public final class CloseableUtils {
     }
 
     public static long getMaxCloseWaitTime(PropertyResolver resolver) {
-        return (resolver == null) ? DEFAULT_CLOSE_WAIT_TIMEOUT : PropertyResolverUtils.getLongProperty(resolver, CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT);
+        return Closeable.getMaxCloseWaitTime(resolver);
     }
 
-    // TODO once JDK 8+ becomes the minimum for this project, make it a static method in the Closeable interface
     public static void close(Closeable closeable) throws IOException {
-        if (closeable == null) {
-            return;
-        }
-
-        if ((!closeable.isClosed()) && (!closeable.isClosing())) {
-            CloseFuture future = closeable.close(true);
-            long maxWait = (closeable instanceof PropertyResolver) ? getMaxCloseWaitTime((PropertyResolver) closeable) : DEFAULT_CLOSE_WAIT_TIMEOUT;
-            boolean successful = future.await(maxWait);
-            if (!successful) {
-                throw new SocketTimeoutException("Failed to receive closure confirmation within " + maxWait + " millis");
-            }
-        }
+        Closeable.close(closeable);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
index 3b6188f..2a24ffc 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
@@ -50,17 +50,13 @@ public class FuturesCloseable<T extends SshFuture> extends SimpleCloseable {
             future.setClosed();
         } else {
             final AtomicInteger count = new AtomicInteger(1);
-            SshFutureListener<T> listener = new SshFutureListener<T>() {
-                @SuppressWarnings("synthetic-access")
-                @Override
-                public void operationComplete(T f) {
-                    int pendingCount = count.decrementAndGet();
-                    if (log.isTraceEnabled()) {
-                        log.trace("doClose(" + immediately + ") complete pending: " + pendingCount);
-                    }
-                    if (pendingCount == 0) {
-                        future.setClosed();
-                    }
+            SshFutureListener<T> listener = f -> {
+                int pendingCount = count.decrementAndGet();
+                if (log.isTraceEnabled()) {
+                    log.trace("doClose(" + immediately + ") complete pending: " + pendingCount);
+                }
+                if (pendingCount == 0) {
+                    future.setClosed();
                 }
             };
             for (SshFuture<T> f : futures) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/IoBaseCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/IoBaseCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/IoBaseCloseable.java
index d4af9d1..e8ef22b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/IoBaseCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/IoBaseCloseable.java
@@ -18,8 +18,6 @@
  */
 package org.apache.sshd.common.util.closeable;
 
-import java.io.IOException;
-
 import org.apache.sshd.common.Closeable;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
 
@@ -35,15 +33,4 @@ public abstract class IoBaseCloseable extends AbstractLoggingBean implements Clo
         super(discriminator);
     }
 
-    // TODO once JDK 8+ becomes the minimum for this project, make it a default method instead of this class
-    @Override
-    public boolean isOpen() {
-        return !(isClosed() || isClosing());
-    }
-
-    // TODO once JDK 8+ becomes the minimum for this project, make it a default method instead of this class
-    @Override
-    public void close() throws IOException {
-        CloseableUtils.close(this);
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
index a009ed8..029c9a0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
@@ -43,17 +43,13 @@ public class ParallelCloseable extends SimpleCloseable {
     @Override
     protected void doClose(final boolean immediately) {
         final AtomicInteger count = new AtomicInteger(1);
-        SshFutureListener<CloseFuture> listener = new SshFutureListener<CloseFuture>() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public void operationComplete(CloseFuture f) {
-                int pendingCount = count.decrementAndGet();
-                if (log.isTraceEnabled()) {
-                    log.trace("doClose(" + immediately + ") completed pending: " + pendingCount);
-                }
-                if (pendingCount == 0) {
-                    future.setClosed();
-                }
+        SshFutureListener<CloseFuture> listener = f -> {
+            int pendingCount = count.decrementAndGet();
+            if (log.isTraceEnabled()) {
+                log.trace("doClose(" + immediately + ") completed pending: " + pendingCount);
+            }
+            if (pendingCount == 0) {
+                future.setClosed();
             }
         };
         for (Closeable c : closeables) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/io/CloseableEmptyInputStream.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/CloseableEmptyInputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/CloseableEmptyInputStream.java
index a11ec96..c9eca70 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/CloseableEmptyInputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/CloseableEmptyInputStream.java
@@ -89,6 +89,7 @@ public class CloseableEmptyInputStream extends EmptyInputStream implements Chann
     @Override
     public void close() throws IOException {
         if (open.getAndSet(false)) {
+            //noinspection UnnecessaryReturnStatement
             return; // debug breakpoint
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java
index 4693dd6..a25a686 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java
@@ -33,55 +33,19 @@ import java.util.Set;
  */
 public interface FileInfoExtractor<T> {
 
-    FileInfoExtractor<Boolean> EXISTS = new FileInfoExtractor<Boolean>() {
-            @Override
-            public Boolean infoOf(Path file, LinkOption... options) throws IOException {
-                return Files.exists(file, options);
-            }
-        };
+    FileInfoExtractor<Boolean> EXISTS = Files::exists;
 
-    FileInfoExtractor<Boolean> ISDIR = new FileInfoExtractor<Boolean>() {
-            @Override
-            public Boolean infoOf(Path file, LinkOption... options) throws IOException {
-                return Files.isDirectory(file, options);
-            }
-        };
+    FileInfoExtractor<Boolean> ISDIR = Files::isDirectory;
 
-    FileInfoExtractor<Boolean> ISREG = new FileInfoExtractor<Boolean>() {
-            @Override
-            public Boolean infoOf(Path file, LinkOption... options) throws IOException {
-                return Files.isRegularFile(file, options);
-            }
-        };
+    FileInfoExtractor<Boolean> ISREG = Files::isRegularFile;
 
-    FileInfoExtractor<Boolean> ISSYMLINK = new FileInfoExtractor<Boolean>() {
-            @Override
-            public Boolean infoOf(Path file, LinkOption... options) throws IOException {
-                return Files.isSymbolicLink(file);
-            }
-        };
+    FileInfoExtractor<Boolean> ISSYMLINK = (file, options) -> Files.isSymbolicLink(file);
 
-    FileInfoExtractor<Long> SIZE = new FileInfoExtractor<Long>() {
-            @Override
-            public Long infoOf(Path file, LinkOption... options) throws IOException {
-                return Files.size(file);
-            }
-        };
+    FileInfoExtractor<Long> SIZE = (file, options) -> Files.size(file);
 
-    FileInfoExtractor<Set<PosixFilePermission>> PERMISSIONS = new FileInfoExtractor<Set<PosixFilePermission>>() {
-            @Override
-            public Set<PosixFilePermission> infoOf(Path file, LinkOption... options) throws IOException {
-                return IoUtils.getPermissions(file, options);
-            }
-        };
+    FileInfoExtractor<Set<PosixFilePermission>> PERMISSIONS = IoUtils::getPermissions;
 
-    FileInfoExtractor<FileTime> LASTMODIFIED = new FileInfoExtractor<FileTime>() {
-        @Override
-        public FileTime infoOf(Path file, LinkOption... options) throws IOException {
-            return Files.getLastModifiedTime(file, options);
-        }
-
-    };
+    FileInfoExtractor<FileTime> LASTMODIFIED = Files::getLastModifiedTime;
 
     T infoOf(Path file, LinkOption ... options) throws IOException;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/io/IoUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/IoUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/IoUtils.java
index c267c85..e8b7dd8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/IoUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/IoUtils.java
@@ -122,6 +122,7 @@ public final class IoUtils {
      * suppressed exceptions to the first one
      * @see Throwable#getSuppressed()
      */
+    @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
     public static IOException closeQuietly(Closeable... closeables) {
         IOException err = null;
         for (Closeable c : closeables) {
@@ -130,7 +131,7 @@ public final class IoUtils {
                     c.close();
                 }
             } catch (IOException e) {
-                GenericUtils.accumulateException(err, e);
+                err = GenericUtils.accumulateException(err, e);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/io/LimitInputStream.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/LimitInputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/LimitInputStream.java
index 0226a4a..bbf956a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/LimitInputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/LimitInputStream.java
@@ -106,6 +106,7 @@ public class LimitInputStream extends FilterInputStream implements Channel {
     public void close() throws IOException {
         // do not close the original input stream since it serves for ACK(s)
         if (open.getAndSet(false)) {
+            //noinspection UnnecessaryReturnStatement
             return; // debug breakpoint
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullInputStream.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullInputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullInputStream.java
index ad7e2ed..5ac7f3e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullInputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullInputStream.java
@@ -82,6 +82,7 @@ public class NullInputStream extends InputStream implements Channel {
     @Override
     public void close() throws IOException {
         if (open.getAndSet(false)) {
+            //noinspection UnnecessaryReturnStatement
             return; // debug breakpoint
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullOutputStream.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullOutputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullOutputStream.java
index 64d59b6..5e3b719 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullOutputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NullOutputStream.java
@@ -64,6 +64,7 @@ public class NullOutputStream extends OutputStream implements Channel {
     @Override
     public void close() throws IOException {
         if (open.getAndSet(false)) {
+            //noinspection UnnecessaryReturnStatement
             return; // debug breakpoint
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
index 5757fb2..45bcf1b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
@@ -58,12 +58,9 @@ public final class LoggingUtils {
      * @see #generateMnemonicMap(Class, Predicate)
      */
     public static Map<Integer, String> generateMnemonicMap(Class<?> clazz, final String commonPrefix) {
-        return generateMnemonicMap(clazz, new Predicate<Field>() {
-            @Override
-            public boolean test(Field f) {
-                String name = f.getName();
-                return name.startsWith(commonPrefix);
-            }
+        return generateMnemonicMap(clazz, f -> {
+            String name = f.getName();
+            return name.startsWith(commonPrefix);
         });
     }
 
@@ -92,9 +89,11 @@ public final class LoggingUtils {
                 Number value = (Number) f.get(null);
                 String prev = result.put(NumberUtils.toInteger(value), name);
                 if (prev != null) {
+                    //noinspection UnnecessaryContinue
                     continue;   // debug breakpoint
                 }
             } catch (Exception e) {
+                //noinspection UnnecessaryContinue
                 continue;   // debug breakpoint
             }
         }
@@ -114,12 +113,9 @@ public final class LoggingUtils {
      * @see #getAmbiguousMenmonics(Class, Predicate)
      */
     public static Map<String, Integer> getAmbiguousMenmonics(Class<?> clazz, String commonPrefix) {
-        return getAmbiguousMenmonics(clazz, new Predicate<Field>() {
-            @Override
-            public boolean test(Field f) {
-                String name = f.getName();
-                return name.startsWith(commonPrefix);
-            }
+        return getAmbiguousMenmonics(clazz, f -> {
+            String name = f.getName();
+            return name.startsWith(commonPrefix);
         });
     }
 
@@ -180,21 +176,18 @@ public final class LoggingUtils {
      * @return A {@link Collection} of all the fields that have satisfied all conditions
      */
     public static Collection<Field> getMnemonicFields(Class<?> clazz, Predicate<? super Field> acceptor) {
-        return ReflectionUtils.getMatchingFields(clazz, new Predicate<Field>() {
-            @Override
-            public boolean test(Field f) {
-                int mods = f.getModifiers();
-                if ((!Modifier.isPublic(mods)) || (!Modifier.isStatic(mods)) || (!Modifier.isFinal(mods))) {
-                    return false;
-                }
-
-                Class<?> type = f.getType();
-                if (!NumberUtils.isNumericClass(type)) {
-                    return false;
-                }
+        return ReflectionUtils.getMatchingFields(clazz, f -> {
+            int mods = f.getModifiers();
+            if ((!Modifier.isPublic(mods)) || (!Modifier.isStatic(mods)) || (!Modifier.isFinal(mods))) {
+                return false;
+            }
 
-                return acceptor.test(f);
+            Class<?> type = f.getType();
+            if (!NumberUtils.isNumericClass(type)) {
+                return false;
             }
+
+            return acceptor.test(f);
         });
     }
 
@@ -263,9 +256,10 @@ public final class LoggingUtils {
     }
 
     // NOTE: assume that level enabled has been checked !!!
+    @SuppressWarnings("StatementWithEmptyBody")
     public static void logMessage(Logger logger, Level level, Object message, Throwable t) {
         if ((logger == null) || (level == null) || Level.OFF.equals(level)) {
-            return;
+            // ignore
         } else if (Level.SEVERE.equals(level)) {
             logger.error(Objects.toString(message), t);
         } else if (Level.WARNING.equals(level)) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/logging/SimplifiedLog.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/SimplifiedLog.java b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/SimplifiedLog.java
index 068d7e1..966f71c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/SimplifiedLog.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/SimplifiedLog.java
@@ -36,7 +36,6 @@ public interface SimplifiedLog {
 
         @Override
         public void log(Level level, Object message, Throwable t) {
-            return;
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java b/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
index e56c290..08b277b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
@@ -79,14 +79,11 @@ public class SshdSocketAddress extends SocketAddress {
      * Compares {@link InetAddress}-es according to their {@link InetAddress#getHostAddress()}
      * value case <U>insensitive</U>
      */
-    public static final Comparator<InetAddress> BY_HOST_ADDRESS = new Comparator<InetAddress>() {
-            @Override
-            public int compare(InetAddress a1, InetAddress a2) {
-                String n1 = GenericUtils.trimToEmpty(toAddressString(a1));
-                String n2 = GenericUtils.trimToEmpty(toAddressString(a2));
-                return String.CASE_INSENSITIVE_ORDER.compare(n1, n2);
-            }
-        };
+    public static final Comparator<InetAddress> BY_HOST_ADDRESS = (a1, a2) -> {
+        String n1 = GenericUtils.trimToEmpty(toAddressString(a1));
+        String n2 = GenericUtils.trimToEmpty(toAddressString(a2));
+        return String.CASE_INSENSITIVE_ORDER.compare(n1, n2);
+    };
 
     private static final long serialVersionUID = 6461645947151952729L;
 
@@ -336,7 +333,7 @@ public class SshdSocketAddress extends SocketAddress {
         }
     }
 
-    public static final boolean isIPv4Address(String addr) {
+    public static boolean isIPv4Address(String addr) {
         if (GenericUtils.isEmpty(addr)) {
             return false;
         }
@@ -367,7 +364,7 @@ public class SshdSocketAddress extends SocketAddress {
      * @see #PRIVATE_CLASS_C_PREFIX
      * @see <A HREF="http://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces">Wiki page</A>
      */
-    public static final boolean isPrivateIPv4Address(String addr) {
+    public static boolean isPrivateIPv4Address(String addr) {
         if (GenericUtils.isEmpty(addr)) {
             return false;
         }
@@ -400,7 +397,7 @@ public class SshdSocketAddress extends SocketAddress {
      * @return {@code true} if the address is in the 100.64.0.0/10 range
      * @see <A HREF="http://tools.ietf.org/html/rfc6598">RFC6598</A>
      */
-    public static final boolean isCarrierGradeNatIPv4Address(String addr) {
+    public static boolean isCarrierGradeNatIPv4Address(String addr) {
         if (GenericUtils.isEmpty(addr)) {
             return false;
         }
@@ -433,7 +430,7 @@ public class SshdSocketAddress extends SocketAddress {
      * @param c The {@link CharSequence} to be validate
      * @return {@code true} if valid IPv4 address component
      */
-    public static final boolean isValidIPv4AddressComponent(CharSequence c) {
+    public static boolean isValidIPv4AddressComponent(CharSequence c) {
         if (GenericUtils.isEmpty(c) || (c.length() > 3)) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
index 4f61d46..de16f41 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
@@ -177,13 +177,8 @@ public final class ThreadUtils {
             Thread t;
             try {
                 // see SSHD-668
-                t = AccessController.doPrivileged(new PrivilegedExceptionAction<Thread>() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public Thread run() {
-                        return new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
-                    }
-                });
+                t = AccessController.doPrivileged((PrivilegedExceptionAction<Thread>) () ->
+                        new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0));
             } catch (PrivilegedActionException e) {
                 Exception err = e.getException();
                 if (err instanceof RuntimeException) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
index 06b970e..d954d81 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
@@ -143,6 +143,14 @@ public interface ServerAuthenticationManager {
      */
     String AUTH_METHODS = "auth-methods";
 
+    UserAuthPublicKeyFactory DEFAULT_USER_AUTH_PUBLIC_KEY_FACTORY = UserAuthPublicKeyFactory.INSTANCE;
+
+    UserAuthGSSFactory DEFAULT_USER_AUTH_GSS_FACTORY = UserAuthGSSFactory.INSTANCE;
+
+    UserAuthPasswordFactory DEFAULT_USER_AUTH_PASSWORD_FACTORY = UserAuthPasswordFactory.INSTANCE;
+
+    UserAuthKeyboardInteractiveFactory DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY = UserAuthKeyboardInteractiveFactory.INSTANCE;
+
     /**
      * Retrieve the list of named factories for <code>UserAuth</code> objects.
      *
@@ -150,10 +158,10 @@ public interface ServerAuthenticationManager {
      */
     List<NamedFactory<UserAuth>> getUserAuthFactories();
     default String getUserAuthFactoriesNameList() {
-        return NamedResource.Utils.getNames(getUserAuthFactories());
+        return NamedResource.getNames(getUserAuthFactories());
     }
     default List<String> getUserAuthFactoriesNames() {
-        return NamedResource.Utils.getNameList(getUserAuthFactories());
+        return NamedResource.getNameList(getUserAuthFactories());
     }
 
     void setUserAuthFactories(List<NamedFactory<UserAuth>> userAuthFactories);
@@ -228,78 +236,89 @@ public interface ServerAuthenticationManager {
     void setHostBasedAuthenticator(HostBasedAuthenticator hostBasedAuthenticator);
 
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
+
         public static final UserAuthPublicKeyFactory DEFAULT_USER_AUTH_PUBLIC_KEY_FACTORY =
-                UserAuthPublicKeyFactory.INSTANCE;
+            ServerAuthenticationManager.DEFAULT_USER_AUTH_PUBLIC_KEY_FACTORY;
 
         public static final UserAuthGSSFactory DEFAULT_USER_AUTH_GSS_FACTORY =
-                UserAuthGSSFactory.INSTANCE;
+                ServerAuthenticationManager.DEFAULT_USER_AUTH_GSS_FACTORY;
 
         public static final UserAuthPasswordFactory DEFAULT_USER_AUTH_PASSWORD_FACTORY =
-                UserAuthPasswordFactory.INSTANCE;
+                ServerAuthenticationManager.DEFAULT_USER_AUTH_PASSWORD_FACTORY;
 
         public static final UserAuthKeyboardInteractiveFactory DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY =
-                UserAuthKeyboardInteractiveFactory.INSTANCE;
+                ServerAuthenticationManager.DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY;
 
         private Utils() {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * If user authentication factories already set, then simply returns them. Otherwise,
-         * builds the factories list from the individual authenticators available for
-         * the manager - password public key, keyboard-interactive, GSS, etc...
-         *
-         * @param manager The {@link ServerAuthenticationManager} - ignored if {@code null}
-         * @return The resolved {@link List} of {@link NamedFactory} for the {@link UserAuth}s
-         * @see #resolveUserAuthFactories(ServerAuthenticationManager, List)
-         */
         public static List<NamedFactory<UserAuth>> resolveUserAuthFactories(ServerAuthenticationManager manager) {
-            if (manager == null) {
-                return Collections.emptyList();
-            } else {
-                return resolveUserAuthFactories(manager, manager.getUserAuthFactories());
-            }
+            return ServerAuthenticationManager.resolveUserAuthFactories(manager);
         }
 
-        /**
-         * If user authentication factories already set, then simply returns them. Otherwise,
-         * builds the factories list from the individual authenticators available for
-         * the manager - password public key, keyboard-interactive, GSS, etc...
-         *
-         * @param manager The {@link ServerAuthenticationManager} - ignored if {@code null}
-         * @param userFactories The currently available {@link UserAuth} factories - if not
-         * {@code null}/empty then they are used as-is.
-         * @return The resolved {@link List} of {@link NamedFactory} for the {@link UserAuth}s
-         */
         public static List<NamedFactory<UserAuth>> resolveUserAuthFactories(
                 ServerAuthenticationManager manager, List<NamedFactory<UserAuth>> userFactories) {
-            if (GenericUtils.size(userFactories) > 0) {
-                return userFactories;   // use whatever the user decided
-            }
-
-            if (manager == null) {
-                return Collections.emptyList();
-            }
-
-            List<NamedFactory<UserAuth>> factories = new ArrayList<>();
-            if (manager.getPasswordAuthenticator() != null) {
-                factories.add(DEFAULT_USER_AUTH_PASSWORD_FACTORY);
-                factories.add(DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY);
-            } else if (manager.getKeyboardInteractiveAuthenticator() != null) {
-                factories.add(DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY);
-            }
-
-            if (manager.getPublickeyAuthenticator() != null) {
-                factories.add(DEFAULT_USER_AUTH_PUBLIC_KEY_FACTORY);
-            }
-
-            if (manager.getGSSAuthenticator() != null) {
-                factories.add(DEFAULT_USER_AUTH_GSS_FACTORY);
-            }
-
-            return factories;
+            return ServerAuthenticationManager.resolveUserAuthFactories(manager, userFactories);
+        }
+    }
+
+    /**
+     * If user authentication factories already set, then simply returns them. Otherwise,
+     * builds the factories list from the individual authenticators available for
+     * the manager - password public key, keyboard-interactive, GSS, etc...
+     *
+     * @param manager The {@link ServerAuthenticationManager} - ignored if {@code null}
+     * @return The resolved {@link List} of {@link NamedFactory} for the {@link UserAuth}s
+     * @see #resolveUserAuthFactories(ServerAuthenticationManager, List)
+     */
+    static List<NamedFactory<UserAuth>> resolveUserAuthFactories(ServerAuthenticationManager manager) {
+        if (manager == null) {
+            return Collections.emptyList();
+        } else {
+            return resolveUserAuthFactories(manager, manager.getUserAuthFactories());
+        }
+    }
+
+    /**
+     * If user authentication factories already set, then simply returns them. Otherwise,
+     * builds the factories list from the individual authenticators available for
+     * the manager - password public key, keyboard-interactive, GSS, etc...
+     *
+     * @param manager The {@link ServerAuthenticationManager} - ignored if {@code null}
+     * @param userFactories The currently available {@link UserAuth} factories - if not
+     * {@code null}/empty then they are used as-is.
+     * @return The resolved {@link List} of {@link NamedFactory} for the {@link UserAuth}s
+     */
+    static List<NamedFactory<UserAuth>> resolveUserAuthFactories(
+            ServerAuthenticationManager manager, List<NamedFactory<UserAuth>> userFactories) {
+        if (GenericUtils.size(userFactories) > 0) {
+            return userFactories;   // use whatever the user decided
         }
+
+        if (manager == null) {
+            return Collections.emptyList();
+        }
+
+        List<NamedFactory<UserAuth>> factories = new ArrayList<>();
+        if (manager.getPasswordAuthenticator() != null) {
+            factories.add(DEFAULT_USER_AUTH_PASSWORD_FACTORY);
+            factories.add(DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY);
+        } else if (manager.getKeyboardInteractiveAuthenticator() != null) {
+            factories.add(DEFAULT_USER_AUTH_KB_INTERACTIVE_FACTORY);
+        }
+
+        if (manager.getPublickeyAuthenticator() != null) {
+            factories.add(DEFAULT_USER_AUTH_PUBLIC_KEY_FACTORY);
+        }
+
+        if (manager.getGSSAuthenticator() != null) {
+            factories.add(DEFAULT_USER_AUTH_GSS_FACTORY);
+        }
+
+        return factories;
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
index 08b3f2e..b8d6a32 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
@@ -52,19 +52,12 @@ import org.apache.sshd.server.kex.DHGServer;
  */
 public class ServerBuilder extends BaseBuilder<SshServer, ServerBuilder> {
 
-    public static final Transformer<DHFactory, NamedFactory<KeyExchange>> DH2KEX =
-        new Transformer<DHFactory, NamedFactory<KeyExchange>>() {
-            @Override
-            public NamedFactory<KeyExchange> transform(DHFactory factory) {
-                if (factory == null) {
-                    return null;
-                } else if (factory.isGroupExchange()) {
-                    return DHGEXServer.newFactory(factory);
-                } else {
-                    return DHGServer.newFactory(factory);
-                }
-            }
-        };
+    public static final Transformer<DHFactory, NamedFactory<KeyExchange>> DH2KEX = factory ->
+            factory == null
+                ? null
+                : factory.isGroupExchange()
+                    ? DHGEXServer.newFactory(factory)
+                    : DHGServer.newFactory(factory);
 
     public static final List<NamedFactory<Channel>> DEFAULT_CHANNEL_FACTORIES =
         Collections.unmodifiableList(Arrays.<NamedFactory<Channel>>asList(
@@ -84,8 +77,8 @@ public class ServerBuilder extends BaseBuilder<SshServer, ServerBuilder> {
     public static final PublickeyAuthenticator DEFAULT_PUBLIC_KEY_AUTHENTICATOR = DefaultAuthorizedKeysAuthenticator.INSTANCE;
     public static final KeyboardInteractiveAuthenticator DEFAULT_INTERACTIVE_AUTHENTICATOR = DefaultKeyboardInteractiveAuthenticator.INSTANCE;
     public static final List<CompressionFactory> DEFAULT_COMPRESSION_FACTORIES =
-            Collections.unmodifiableList(Arrays.<CompressionFactory>asList(
-                    BuiltinCompressions.none, BuiltinCompressions.zlib, BuiltinCompressions.delayedZlib));
+        Collections.unmodifiableList(Arrays.<CompressionFactory>asList(
+                BuiltinCompressions.none, BuiltinCompressions.zlib, BuiltinCompressions.delayedZlib));
 
     protected PublickeyAuthenticator pubkeyAuthenticator;
     protected KeyboardInteractiveAuthenticator interactiveAuthenticator;
@@ -109,7 +102,7 @@ public class ServerBuilder extends BaseBuilder<SshServer, ServerBuilder> {
         super.fillWithDefaultValues();
 
         if (compressionFactories == null) {
-            compressionFactories = NamedFactory.Utils.setUpBuiltinFactories(false, DEFAULT_COMPRESSION_FACTORIES);
+            compressionFactories = NamedFactory.setUpBuiltinFactories(false, DEFAULT_COMPRESSION_FACTORIES);
         }
 
         if (keyExchangeFactories == null) {
@@ -160,7 +153,7 @@ public class ServerBuilder extends BaseBuilder<SshServer, ServerBuilder> {
      * @see org.apache.sshd.common.kex.BuiltinDHFactories#isSupported()
      */
     public static List<NamedFactory<KeyExchange>> setUpDefaultKeyExchanges(boolean ignoreUnsupported) {
-        return NamedFactory.Utils.setUpTransformedFactories(ignoreUnsupported, DEFAULT_KEX_PREFERENCE, DH2KEX);
+        return NamedFactory.setUpTransformedFactories(ignoreUnsupported, DEFAULT_KEX_PREFERENCE, DH2KEX);
     }
 
     public static ServerBuilder builder() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/Signal.java b/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
index ad4917e..bbbddb6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
@@ -19,11 +19,11 @@
 package org.apache.sshd.server;
 
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.EnumSet;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeMap;
+import java.util.function.Function;
 
 import org.apache.sshd.common.util.GenericUtils;
 
@@ -75,15 +75,8 @@ public enum Signal {
      * @see #SIGNALS
      */
     public static final Map<String, Signal> NAME_LOOKUP_TABLE =
-            Collections.unmodifiableMap(new TreeMap<String, Signal>(String.CASE_INSENSITIVE_ORDER) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    for (Signal s : SIGNALS) {
-                        put(s.name(), s);
-                    }
-                }
-            });
+            Collections.unmodifiableMap(
+                    GenericUtils.toSortedMap(SIGNALS, Signal::name, Function.identity(), String.CASE_INSENSITIVE_ORDER));
 
     /**
      * An un-modifiable {@link Map} of the numeric values of all available {@link Signal}s
@@ -91,15 +84,8 @@ public enum Signal {
      * @see #getNumeric()
      */
     public static final Map<Integer, Signal> NUMERIC_LOOKUP_TABLE =
-            Collections.unmodifiableMap(new HashMap<Integer, Signal>(SIGNALS.size()) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    for (Signal s : SIGNALS) {
-                        put(s.getNumeric(), s);
-                    }
-                }
-            });
+            Collections.unmodifiableMap(
+                    GenericUtils.toSortedMap(SIGNALS, Signal::getNumeric, Function.identity(), Comparator.naturalOrder()));
 
     private final int numeric;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
index a9c836a..b55fd59 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
@@ -72,7 +72,6 @@ import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
 import org.apache.sshd.server.scp.ScpCommandFactory;
 import org.apache.sshd.server.session.ServerConnectionServiceFactory;
 import org.apache.sshd.server.session.ServerProxyAcceptor;
-import org.apache.sshd.server.session.ServerSession;
 import org.apache.sshd.server.session.ServerUserAuthServiceFactory;
 import org.apache.sshd.server.session.SessionFactory;
 import org.apache.sshd.server.shell.InteractiveProcessShellFactory;
@@ -108,12 +107,7 @@ import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
  */
 public class SshServer extends AbstractFactoryManager implements ServerFactoryManager, Closeable {
 
-    public static final Factory<SshServer> DEFAULT_SSH_SERVER_FACTORY = new Factory<SshServer>() {
-        @Override
-        public SshServer create() {
-            return new SshServer();
-        }
-    };
+    public static final Factory<SshServer> DEFAULT_SSH_SERVER_FACTORY = SshServer::new;
 
     public static final List<ServiceFactory> DEFAULT_SERVICE_FACTORIES =
             Collections.unmodifiableList(Arrays.asList(
@@ -279,7 +273,7 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
 
         ValidateUtils.checkTrue(getPort() >= 0 /* zero means not set yet */, "Bad port number: %d", Integer.valueOf(getPort()));
 
-        List<NamedFactory<UserAuth>> authFactories = ServerAuthenticationManager.Utils.resolveUserAuthFactories(this);
+        List<NamedFactory<UserAuth>> authFactories = ServerAuthenticationManager.resolveUserAuthFactories(this);
         setUserAuthFactories(ValidateUtils.checkNotNullAndNotEmpty(authFactories, "UserAuthFactories not set"));
 
         ValidateUtils.checkNotNullAndNotEmpty(getChannelFactories(), "ChannelFactories not set");
@@ -358,26 +352,16 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
     @Override
     protected Closeable getInnerCloseable() {
         return builder()
-                .run(new Runnable() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public void run() {
-                        removeSessionTimeout(sessionFactory);
-                    }
-                })
+                .run(() -> removeSessionTimeout(sessionFactory))
                 .sequential(acceptor, ioServiceFactory)
-                .run(new Runnable() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public void run() {
-                        acceptor = null;
-                        ioServiceFactory = null;
-                        if (shutdownExecutor && (executor != null) && (!executor.isShutdown())) {
-                            try {
-                                executor.shutdownNow();
-                            } finally {
-                                executor = null;
-                            }
+                .run(() -> {
+                    acceptor = null;
+                    ioServiceFactory = null;
+                    if (shutdownExecutor && (executor != null) && (!executor.isShutdown())) {
+                        try {
+                            executor.shutdownNow();
+                        } finally {
+                            executor = null;
                         }
                     }
                 })
@@ -587,20 +571,12 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
         sshd.setPort(port);
 
         sshd.setShellFactory(InteractiveProcessShellFactory.INSTANCE);
-        sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
-            @Override
-            public boolean authenticate(String username, String password, ServerSession session) {
-                return (GenericUtils.length(username) > 0) && username.equals(password);
-            }
-        });
+        sshd.setPasswordAuthenticator((username, password, session) -> Objects.equals(username, password));
         sshd.setPublickeyAuthenticator(AcceptAllPublickeyAuthenticator.INSTANCE);
         sshd.setTcpipForwardingFilter(AcceptAllForwardingFilter.INSTANCE);
-        sshd.setCommandFactory(new ScpCommandFactory.Builder().withDelegate(new CommandFactory() {
-            @Override
-            public Command createCommand(String command) {
-                return new ProcessShellFactory(GenericUtils.split(command, ' ')).create();
-            }
-        }).build());
+        sshd.setCommandFactory(new ScpCommandFactory.Builder().withDelegate(
+            command -> new ProcessShellFactory(GenericUtils.split(command, ' ')).create()
+        ).build());
         sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
         sshd.start();
 
@@ -621,7 +597,7 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
         }
 
         Object banner;
-        if (GenericUtils.length(bannerOption) > 0) {
+        if (GenericUtils.isNotEmpty(bannerOption)) {
             if ("none".equals(bannerOption)) {
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
index 4e69543..a77512d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
@@ -74,7 +74,7 @@ public enum BuiltinUserAuthFactories implements NamedFactory<UserAuthFactory> {
      * @return The matching factory instance - {@code null} if no match found
      */
     public static UserAuthFactory fromFactoryName(String name) {
-        Factory<UserAuthFactory> factory = NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
         if (factory == null) {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/CredentialHelper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/CredentialHelper.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/CredentialHelper.java
index 129ac0a..2e36ab6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/CredentialHelper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/CredentialHelper.java
@@ -22,6 +22,7 @@ import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.HashMap;
 import java.util.Map;
+
 import javax.security.auth.Subject;
 import javax.security.auth.login.AppConfigurationEntry;
 import javax.security.auth.login.Configuration;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/GSSAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/GSSAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/GSSAuthenticator.java
index b11f18d..7a97ab6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/GSSAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/GSSAuthenticator.java
@@ -20,6 +20,7 @@ package org.apache.sshd.server.auth.gss;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+
 import javax.security.auth.login.LoginException;
 
 import org.apache.sshd.server.session.ServerSession;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
index 2f501c3..c48ebb6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
@@ -144,7 +144,7 @@ public class UserAuthHostBased extends AbstractUserAuth implements SignatureFact
                         "No signature factories for session=%s",
                         session);
         Signature verifier = ValidateUtils.checkNotNull(
-                NamedFactory.Utils.create(factories, keyType),
+                NamedFactory.create(factories, keyType),
                 "No verifier located for algorithm=%s",
                 keyType);
         verifier.initVerifier(clientKey);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
index 45af83f..5f4d49b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
@@ -38,7 +38,7 @@ import org.apache.sshd.server.session.ServerSession;
 public class CachingPublicKeyAuthenticator extends AbstractLoggingBean implements PublickeyAuthenticator, SessionListener {
 
     protected final PublickeyAuthenticator authenticator;
-    protected final Map<ServerSession, Map<PublicKey, Boolean>> cache = new ConcurrentHashMap<>();
+    protected final Map<Session, Map<PublicKey, Boolean>> cache = new ConcurrentHashMap<>();
 
     public CachingPublicKeyAuthenticator(PublickeyAuthenticator authenticator) {
         this.authenticator = ValidateUtils.checkNotNull(authenticator, "No delegate authenticator");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/UserAuthPublicKey.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/UserAuthPublicKey.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/UserAuthPublicKey.java
index e52f176..aa65835 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/UserAuthPublicKey.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/UserAuthPublicKey.java
@@ -88,11 +88,11 @@ public class UserAuthPublicKey extends AbstractUserAuth implements SignatureFact
                         session);
         if (log.isDebugEnabled()) {
             log.debug("doAuth({}@{}) verify key type={}, factories={}, fingerprint={}",
-                      username, session, alg, NamedResource.Utils.getNames(factories), KeyUtils.getFingerPrint(key));
+                      username, session, alg, NamedResource.getNames(factories), KeyUtils.getFingerPrint(key));
         }
 
         Signature verifier = ValidateUtils.checkNotNull(
-                NamedFactory.Utils.create(factories, alg),
+                NamedFactory.create(factories, alg),
                 "No verifier located for algorithm=%s",
                 alg);
         verifier.initVerifier(key);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
index 22383e7..2c097c6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
@@ -20,7 +20,6 @@ package org.apache.sshd.server.channel;
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -68,7 +67,6 @@ import org.apache.sshd.server.ChannelSessionAware;
 import org.apache.sshd.server.Command;
 import org.apache.sshd.server.CommandFactory;
 import org.apache.sshd.server.Environment;
-import org.apache.sshd.server.ExitCallback;
 import org.apache.sshd.server.ServerFactoryManager;
 import org.apache.sshd.server.SessionAware;
 import org.apache.sshd.server.Signal;
@@ -84,8 +82,7 @@ import org.apache.sshd.server.x11.X11ForwardSupport;
  */
 public class ChannelSession extends AbstractServerChannel {
     public static final List<ChannelRequestHandler> DEFAULT_HANDLERS =
-            Collections.unmodifiableList(
-                    Arrays.<ChannelRequestHandler>asList(PuttyRequestHandler.INSTANCE));
+            Collections.<ChannelRequestHandler>singletonList(PuttyRequestHandler.INSTANCE);
 
     protected String type;
     protected ChannelAsyncOutputStream asyncOut;
@@ -179,12 +176,7 @@ public class ChannelSession extends AbstractServerChannel {
                 FactoryManager manager = ValidateUtils.checkNotNull(s.getFactoryManager(), "No factory manager");
                 ScheduledExecutorService scheduler = ValidateUtils.checkNotNull(manager.getScheduledExecutorService(), "No scheduling service");
                 scheduler.schedule(task, timeout, TimeUnit.MILLISECONDS);
-                commandExitFuture.addListener(new SshFutureListener<CloseFuture>() {
-                    @Override
-                    public void operationComplete(CloseFuture future) {
-                        task.cancel();
-                    }
-                });
+                commandExitFuture.addListener(future -> task.cancel());
             }
             return commandExitFuture;
         }
@@ -559,7 +551,7 @@ public class ChannelSession extends AbstractServerChannel {
         }
 
         try {
-            commandInstance = NamedFactory.Utils.create(factories, subsystem);
+            commandInstance = NamedFactory.create(factories, subsystem);
         } catch (RuntimeException | Error e) {
             log.warn("handleSubsystem({}) Failed ({}) to create command for subsystem={}: {}",
                       this, e.getClass().getSimpleName(), subsystem, e.getMessage());
@@ -680,19 +672,15 @@ public class ChannelSession extends AbstractServerChannel {
             tempBuffer = null;
             doWriteData(buffer.array(), buffer.rpos(), buffer.available());
         }
-        command.setExitCallback(new ExitCallback() {
-            @Override
-            @SuppressWarnings("synthetic-access")
-            public void onExit(int exitValue, String exitMessage) {
-                try {
-                    closeShell(exitValue);
-                    if (log.isDebugEnabled()) {
-                        log.debug("onExit({}) code={} message='{}' shell closed", ChannelSession.this, exitValue, exitMessage);
-                    }
-                } catch (IOException e) {
-                    log.warn("onExit({}) code={} message='{}' {} closing shell: {}",
-                             ChannelSession.this, exitValue, exitMessage, e.getClass().getSimpleName(), e.getMessage());
+        command.setExitCallback((exitValue, exitMessage) -> {
+            try {
+                closeShell(exitValue);
+                if (log.isDebugEnabled()) {
+                    log.debug("onExit({}) code={} message='{}' shell closed", ChannelSession.this, exitValue, exitMessage);
                 }
+            } catch (IOException e) {
+                log.warn("onExit({}) code={} message='{}' {} closing shell: {}",
+                         ChannelSession.this, exitValue, exitMessage, e.getClass().getSimpleName(), e.getMessage());
             }
         });
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
index 050a0ab..c2884b9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
@@ -111,7 +111,7 @@ public class AuthorizedKeysAuthenticator extends ModifiableFileWatcher implement
     }
 
     protected boolean isValidUsername(String username, ServerSession session) {
-        return !GenericUtils.isEmpty(username);
+        return GenericUtils.isNotEmpty(username);
     }
 
     protected PublickeyAuthenticator resolvePublickeyAuthenticator(String username, ServerSession session)

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java
index 3a9f0f2..f31db14 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java
@@ -57,12 +57,7 @@ public final class ServerIdentity {
     public static final String HOST_KEY_CONFIG_PROP = "HostKey";
 
     public static final Transformer<String, String> ID_GENERATOR =
-        new Transformer<String, String>() {
-            @Override
-            public String transform(String input) {
-                return getIdentityFileName(input);
-            }
-        };
+            ServerIdentity::getIdentityFileName;
 
     private ServerIdentity() {
         throw new UnsupportedOperationException("No instance");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java b/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java
index 23e2f14..09bacab 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java
@@ -133,7 +133,7 @@ public interface ForwardingFilter {
          * or {@code null} if no match found
          */
         public static Type fromName(String name) {
-            return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+            return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
index e655113..00dc37b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
@@ -36,12 +36,10 @@ import org.apache.sshd.common.channel.ChannelOutputStream;
 import org.apache.sshd.common.channel.OpenChannelException;
 import org.apache.sshd.common.channel.Window;
 import org.apache.sshd.common.future.CloseFuture;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.io.IoConnectFuture;
 import org.apache.sshd.common.io.IoConnector;
 import org.apache.sshd.common.io.IoHandler;
 import org.apache.sshd.common.io.IoSession;
-import org.apache.sshd.common.io.IoWriteFuture;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.Readable;
@@ -188,12 +186,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
 
         connector = manager.getIoServiceFactory().createConnector(handler);
         IoConnectFuture future = connector.connect(address.toInetSocketAddress());
-        future.addListener(new SshFutureListener<IoConnectFuture>() {
-            @Override
-            public void operationComplete(IoConnectFuture future) {
-                handleChannelConnectResult(f, future);
-            }
-        });
+        future.addListener(future1 -> handleChannelConnectResult(f, future1));
         return f;
     }
 
@@ -315,18 +308,14 @@ public class TcpipServerChannel extends AbstractServerChannel {
                 : service;
         // shutdown the temporary executor service if had to create it
         final boolean shutdown = executors != service || isShutdownOnExit();
-        executors.submit(new Runnable() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public void run() {
-                try {
-                    connector.close(true);
-                } finally {
-                    if ((executors != null) && (!executors.isShutdown()) && shutdown) {
-                        Collection<Runnable> runners = executors.shutdownNow();
-                        if (log.isDebugEnabled()) {
-                            log.debug("destroy({}) - shutdown executor service - runners count={}", TcpipServerChannel.this, runners.size());
-                        }
+        executors.submit(() -> {
+            try {
+                connector.close(true);
+            } finally {
+                if (shutdown && !executors.isShutdown()) {
+                    Collection<Runnable> runners = executors.shutdownNow();
+                    if (log.isDebugEnabled()) {
+                        log.debug("destroy({}) - shutdown executor service - runners count={}", TcpipServerChannel.this, runners.size());
                     }
                 }
             }
@@ -335,27 +324,18 @@ public class TcpipServerChannel extends AbstractServerChannel {
 
     @Override
     public CloseFuture close(boolean immediately) {
-        return super.close(immediately).addListener(new SshFutureListener<CloseFuture>() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public void operationComplete(CloseFuture sshFuture) {
-                closeImmediately0();
-            }
-        });
+        return super.close(immediately).addListener(sshFuture -> closeImmediately0());
     }
 
     @Override
     protected void doWriteData(byte[] data, int off, final int len) throws IOException {
         // Make sure we copy the data as the incoming buffer may be reused
         final Buffer buf = ByteArrayBuffer.getCompactClone(data, off, len);
-        ioSession.write(buf).addListener(new SshFutureListener<IoWriteFuture>() {
-            @Override
-            public void operationComplete(IoWriteFuture future) {
-                if (future.isWritten()) {
-                    handleWriteDataSuccess(SshConstants.SSH_MSG_CHANNEL_DATA, buf.array(), 0, len);
-                } else {
-                    handleWriteDataFailure(SshConstants.SSH_MSG_CHANNEL_DATA, buf.array(), 0, len, future.getException());
-                }
+        ioSession.write(buf).addListener(future -> {
+            if (future.isWritten()) {
+                handleWriteDataSuccess(SshConstants.SSH_MSG_CHANNEL_DATA, buf.array(), 0, len);
+            } else {
+                handleWriteDataFailure(SshConstants.SSH_MSG_CHANNEL_DATA, buf.array(), 0, len, future.getException());
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/global/CancelTcpipForwardHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/global/CancelTcpipForwardHandler.java b/sshd-core/src/main/java/org/apache/sshd/server/global/CancelTcpipForwardHandler.java
index 457ded9..354d678 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/global/CancelTcpipForwardHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/global/CancelTcpipForwardHandler.java
@@ -38,7 +38,7 @@ public class CancelTcpipForwardHandler extends AbstractConnectionServiceRequestH
     /**
      * Default growth factor function used to resize response buffers
      */
-    public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR = Int2IntFunction.Utils.add(Byte.SIZE);
+    public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR = Int2IntFunction.add(Byte.SIZE);
 
     public static final CancelTcpipForwardHandler INSTANCE = new CancelTcpipForwardHandler();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/global/OpenSshHostKeysHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/global/OpenSshHostKeysHandler.java b/sshd-core/src/main/java/org/apache/sshd/server/global/OpenSshHostKeysHandler.java
index e84f82c..ce54b2d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/global/OpenSshHostKeysHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/global/OpenSshHostKeysHandler.java
@@ -92,7 +92,7 @@ public class OpenSshHostKeysHandler extends AbstractOpenSshHostKeysHandler imple
                         session);
         if (log.isDebugEnabled()) {
             log.debug("handleHostKeys({})[want-reply={}] received {} keys - factories={}",
-                      session, wantReply, GenericUtils.size(keys), NamedResource.Utils.getNames(factories));
+                      session, wantReply, GenericUtils.size(keys), NamedResource.getNames(factories));
         }
 
         // generate the required signatures
@@ -104,7 +104,7 @@ public class OpenSshHostKeysHandler extends AbstractOpenSshHostKeysHandler imple
         for (PublicKey k : keys) {
             String keyType = KeyUtils.getKeyType(k);
             Signature verifier = ValidateUtils.checkNotNull(
-                    NamedFactory.Utils.create(factories, keyType),
+                    NamedFactory.create(factories, keyType),
                     "No signer could be located for key type=%s",
                     keyType);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java b/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java
index a8dd753..8b3368e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/global/TcpipForwardHandler.java
@@ -39,7 +39,7 @@ public class TcpipForwardHandler extends AbstractConnectionServiceRequestHandler
     /**
      * Default growth factor function used to resize response buffers
      */
-    public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR = Int2IntFunction.Utils.add(Byte.SIZE);
+    public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR = Int2IntFunction.add(Byte.SIZE);
 
     public static final TcpipForwardHandler INSTANCE = new TcpipForwardHandler();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java
index 300b545..30d0d89 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java
@@ -18,10 +18,8 @@
  */
 package org.apache.sshd.server.jaas;
 
-import java.io.IOException;
 import javax.security.auth.Subject;
 import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.NameCallback;
 import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
@@ -64,17 +62,14 @@ public class JaasPasswordAuthenticator extends AbstractLoggingBean implements Pa
     public boolean authenticate(final String username, final String password) {
         try {
             Subject subject = new Subject();
-            LoginContext loginContext = new LoginContext(domain, subject, new CallbackHandler() {
-                @Override
-                public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
-                    for (Callback callback : callbacks) {
-                        if (callback instanceof NameCallback) {
-                            ((NameCallback) callback).setName(username);
-                        } else if (callback instanceof PasswordCallback) {
-                            ((PasswordCallback) callback).setPassword(password.toCharArray());
-                        } else {
-                            throw new UnsupportedCallbackException(callback);
-                        }
+            LoginContext loginContext = new LoginContext(domain, subject, callbacks -> {
+                for (Callback callback : callbacks) {
+                    if (callback instanceof NameCallback) {
+                        ((NameCallback) callback).setName(username);
+                    } else if (callback instanceof PasswordCallback) {
+                        ((PasswordCallback) callback).setPassword(password.toCharArray());
+                    } else {
+                        throw new UnsupportedCallbackException(callback);
                     }
                 }
             });

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEXServer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEXServer.java b/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEXServer.java
index e867f29..1cf3676 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEXServer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEXServer.java
@@ -104,7 +104,7 @@ public class DHGEXServer extends AbstractDHServerKeyExchange {
     public boolean next(int cmd, Buffer buffer) throws Exception {
         ServerSession session = getServerSession();
         if (log.isDebugEnabled()) {
-            log.debug("next({})[{}] process command={}", this, session, KeyExchange.Utils.getGroupKexOpcodeName(cmd));
+            log.debug("next({})[{}] process command={}", this, session, KeyExchange.getGroupKexOpcodeName(cmd));
         }
 
         if (cmd == SshConstants.SSH_MSG_KEX_DH_GEX_REQUEST_OLD && expected == SshConstants.SSH_MSG_KEX_DH_GEX_REQUEST) {
@@ -162,8 +162,8 @@ public class DHGEXServer extends AbstractDHServerKeyExchange {
 
         if (cmd != expected) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_KEY_EXCHANGE_FAILED,
-                    "Protocol error: expected packet " + KeyExchange.Utils.getGroupKexOpcodeName(expected)
-                  + ", got " + KeyExchange.Utils.getGroupKexOpcodeName(cmd));
+                    "Protocol error: expected packet " + KeyExchange.getGroupKexOpcodeName(expected)
+                  + ", got " + KeyExchange.getGroupKexOpcodeName(cmd));
         }
 
         if (cmd == SshConstants.SSH_MSG_KEX_DH_GEX_INIT) {
@@ -176,7 +176,7 @@ public class DHGEXServer extends AbstractDHServerKeyExchange {
             KeyPair kp = ValidateUtils.checkNotNull(session.getHostKey(), "No server key pair available");
             String algo = session.getNegotiatedKexParameter(KexProposalOption.SERVERKEYS);
             Signature sig = ValidateUtils.checkNotNull(
-                    NamedFactory.Utils.create(session.getSignatureFactories(), algo),
+                    NamedFactory.create(session.getSignatureFactories(), algo),
                     "Unknown negotiated server keys: %s",
                     algo);
             sig.initSigner(kp.getPrivate());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGServer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGServer.java b/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGServer.java
index 81bbae6..3110c29 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGServer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGServer.java
@@ -87,12 +87,12 @@ public class DHGServer extends AbstractDHServerKeyExchange {
     public boolean next(int cmd, Buffer buffer) throws Exception {
         ServerSession session = getServerSession();
         if (log.isDebugEnabled()) {
-            log.debug("next({})[{}] process command={}", this, session, KeyExchange.Utils.getSimpleKexOpcodeName(cmd));
+            log.debug("next({})[{}] process command={}", this, session, KeyExchange.getSimpleKexOpcodeName(cmd));
         }
 
         if (cmd != SshConstants.SSH_MSG_KEXDH_INIT) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_KEY_EXCHANGE_FAILED,
-                    "Protocol error: expected packet SSH_MSG_KEXDH_INIT, got " + KeyExchange.Utils.getSimpleKexOpcodeName(cmd));
+                    "Protocol error: expected packet SSH_MSG_KEXDH_INIT, got " + KeyExchange.getSimpleKexOpcodeName(cmd));
         }
 
         e = buffer.getMPIntAsBytes();
@@ -102,7 +102,7 @@ public class DHGServer extends AbstractDHServerKeyExchange {
         KeyPair kp = ValidateUtils.checkNotNull(session.getHostKey(), "No server key pair available");
         String algo = session.getNegotiatedKexParameter(KexProposalOption.SERVERKEYS);
         Signature sig = ValidateUtils.checkNotNull(
-                NamedFactory.Utils.create(session.getSignatureFactories(), algo),
+                NamedFactory.create(session.getSignatureFactories(), algo),
                 "Unknown negotiated server keys: %s",
                 algo);
         sig.initSigner(kp.getPrivate());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java b/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
index 5026e1b..44869d3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
@@ -36,7 +36,6 @@ import org.apache.sshd.common.ServiceFactory;
 import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.SshException;
 import org.apache.sshd.common.auth.AbstractUserAuthServiceFactory;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.io.IoService;
 import org.apache.sshd.common.io.IoSession;
 import org.apache.sshd.common.io.IoWriteFuture;
@@ -205,7 +204,7 @@ public abstract class AbstractServerSession extends AbstractSession implements S
     @Override
     public void startService(String name) throws Exception {
         FactoryManager factoryManager = getFactoryManager();
-        currentService = ServiceFactory.Utils.create(
+        currentService = ServiceFactory.create(
                         factoryManager.getServiceFactories(),
                         ValidateUtils.checkNotNullAndNotEmpty(name, "No service name"),
                         this);
@@ -246,7 +245,7 @@ public abstract class AbstractServerSession extends AbstractSession implements S
         ValidateUtils.checkTrue(proposedManager == getFactoryManager(), "Mismatched signatures proposed factory manager");
 
         KeyPairProvider kpp = getKeyPairProvider();
-        Collection<String> supported = NamedResource.Utils.getNameList(getSignatureFactories());
+        Collection<String> supported = NamedResource.getNameList(getSignatureFactories());
         Iterable<String> provided;
         try {
             provided = (kpp == null) ? null : kpp.getKeyTypes();
@@ -363,12 +362,7 @@ public abstract class AbstractServerSession extends AbstractSession implements S
 
         if (GenericUtils.length(errorMessage) > 0) {
             ioSession.write(new ByteArrayBuffer((errorMessage + "\n").getBytes(StandardCharsets.UTF_8)))
-                     .addListener(new SshFutureListener<IoWriteFuture>() {
-                         @Override
-                         public void operationComplete(IoWriteFuture future) {
-                             close(true);
-                         }
-                     });
+                     .addListener(future -> close(true));
             throw new SshException(errorMessage);
         }
 


[06/16] mina-sshd git commit: [SSHD-698] Use <> when possible

Posted by gn...@apache.org.
[SSHD-698] Use <> when possible

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/195874b4
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/195874b4
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/195874b4

Branch: refs/heads/master
Commit: 195874b47c807fee4c4a3fb84fd43eb5d04c0925
Parents: 8804691
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Sep 15 11:25:18 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Sep 15 21:06:31 2016 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/sshd/agent/unix/AgentClient.java    | 2 +-
 .../sshd/client/auth/AuthenticationIdentitiesProvider.java   | 2 +-
 .../sshd/client/auth/hostbased/HostKeyIdentityProvider.java  | 2 +-
 .../sshd/client/auth/password/PasswordIdentityProvider.java  | 2 +-
 .../client/config/hosts/ConfigFileHostEntryResolver.java     | 2 +-
 .../org/apache/sshd/client/config/hosts/HostConfigEntry.java | 2 +-
 .../apache/sshd/client/config/hosts/HostPatternsHolder.java  | 2 +-
 .../sshd/client/keyverifier/KnownHostsServerKeyVerifier.java | 4 ++--
 .../sftp/extensions/helpers/AbstractCheckFileExtension.java  | 2 +-
 .../main/java/org/apache/sshd/common/SyspropsMapWrapper.java | 2 +-
 .../apache/sshd/common/channel/BufferedIoOutputStream.java   | 4 ++--
 .../java/org/apache/sshd/common/channel/SttySupport.java     | 6 +++---
 .../java/org/apache/sshd/common/config/TimeValueConfig.java  | 2 +-
 .../apache/sshd/common/config/keys/AuthorizedKeyEntry.java   | 2 +-
 .../main/java/org/apache/sshd/common/forward/SocksProxy.java | 2 +-
 .../sshd/common/keyprovider/AbstractFileKeyPairProvider.java | 2 +-
 .../sshd/common/keyprovider/MappedKeyPairProvider.java       | 2 +-
 .../sshd/common/session/helpers/SessionTimeoutListener.java  | 2 +-
 .../org/apache/sshd/common/subsystem/sftp/SftpHelper.java    | 4 ++--
 .../common/subsystem/sftp/extensions/AclSupportedParser.java | 4 ++--
 .../sshd/common/subsystem/sftp/extensions/ParserUtils.java   | 2 +-
 .../main/java/org/apache/sshd/common/util/SelectorUtils.java | 2 +-
 .../java/org/apache/sshd/common/util/closeable/Builder.java  | 4 ++--
 .../apache/sshd/common/util/io/ModifiableFileWatcher.java    | 4 ++--
 .../org/apache/sshd/common/util/net/SshdSocketAddress.java   | 2 +-
 .../org/apache/sshd/common/util/threads/ThreadUtils.java     | 4 ++--
 .../server/auth/keyboard/UserAuthKeyboardInteractive.java    | 2 +-
 .../server/auth/pubkey/CachingPublicKeyAuthenticator.java    | 2 +-
 .../sshd/server/config/keys/AuthorizedKeysAuthenticator.java | 2 +-
 .../src/main/java/org/apache/sshd/server/kex/Moduli.java     | 2 +-
 .../main/java/org/apache/sshd/git/pack/GitPackCommand.java   | 2 +-
 .../java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java  | 2 +-
 .../apache/sshd/common/util/net/LdapNetworkConnector.java    | 8 ++++----
 .../sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java  | 2 +-
 34 files changed, 46 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
index ac9fab8..97acd90 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
@@ -67,7 +67,7 @@ public class AgentClient extends AbstractAgentProxy implements Runnable {
                 throwException(result);
             }
             receiveBuffer = new ByteArrayBuffer();
-            messages = new ArrayBlockingQueue<Buffer>(10);
+            messages = new ArrayBlockingQueue<>(10);
 
             ExecutorService service = getExecutorService();
             pumper = service.submit(this);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java
index 56ef102..7afd266 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java
@@ -128,7 +128,7 @@ public interface AuthenticationIdentitiesProvider extends KeyIdentityProvider, P
                         }
 
                         if (matches == null) {
-                            matches = new LinkedList<T>();
+                            matches = new LinkedList<>();
                         }
 
                         matches.add(type.cast(o));

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
index d7879b5..5362d8f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
@@ -75,7 +75,7 @@ public interface HostKeyIdentityProvider {
                                 @Override
                                 public Pair<KeyPair, List<X509Certificate>> next() {
                                     KeyPair kp = iter.next();
-                                    return new Pair<KeyPair, List<X509Certificate>>(kp, Collections.emptyList());
+                                    return new Pair<>(kp, Collections.emptyList());
                                 }
 
                                 @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
index d126594..fe37f39 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
@@ -174,7 +174,7 @@ public interface PasswordIdentityProvider {
                 return Collections.emptyList();
             }
 
-            Collection<Supplier<Iterable<String>>> suppliers = new ArrayList<Supplier<Iterable<String>>>(providers.size());
+            Collection<Supplier<Iterable<String>>> suppliers = new ArrayList<>(providers.size());
             for (final PasswordIdentityProvider p : providers) {
                 if (p == null) {
                     continue;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java
index b5d5372..70a4f33 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java
@@ -39,7 +39,7 @@ import org.apache.sshd.common.util.io.ModifiableFileWatcher;
  */
 public class ConfigFileHostEntryResolver extends ModifiableFileWatcher implements HostConfigEntryResolver {
     private final AtomicReference<HostConfigEntryResolver> delegateHolder = // assumes initially empty
-            new AtomicReference<HostConfigEntryResolver>(HostConfigEntryResolver.EMPTY);
+            new AtomicReference<>(HostConfigEntryResolver.EMPTY);
 
     public ConfigFileHostEntryResolver(File file) {
         this(ValidateUtils.checkNotNull(file, "No file to watch").toPath());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
index 4a9eda4..20e1f40 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
@@ -717,7 +717,7 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
 
         Map<String, String> props = entry.getProperties();
         if (GenericUtils.size(props) > 0) {
-            normal.setProperties(new TreeMap<String, String>(props));
+            normal.setProperties(new TreeMap<>(props));
         }
 
         Collection<String> ids = entry.getIdentities();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
index e9d0269..e81d01c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
@@ -266,7 +266,7 @@ public abstract class HostPatternsHolder {
             }
         }
 
-        return new Pair<Pattern, Boolean>(Pattern.compile(sb.toString(), Pattern.CASE_INSENSITIVE), negated);
+        return new Pair<>(Pattern.compile(sb.toString(), Pattern.CASE_INSENSITIVE), negated);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
index e62d4b3..93fa5eb 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
@@ -117,7 +117,7 @@ public class KnownHostsServerKeyVerifier
     protected final Object updateLock = new Object();
     private final ServerKeyVerifier delegate;
     private final AtomicReference<Collection<HostEntryPair>> keysHolder =
-            new AtomicReference<Collection<HostEntryPair>>(Collections.emptyList());
+            new AtomicReference<>(Collections.emptyList());
     private ModifiedServerKeyAcceptor modKeyAcceptor;
 
     public KnownHostsServerKeyVerifier(ServerKeyVerifier delegate, Path file) {
@@ -733,7 +733,7 @@ public class KnownHostsServerKeyVerifier
          * NOTE !!! we do not resolve the fully-qualified name to avoid long DNS timeouts.
          * Instead we use the reported peer address and the original connection target host
          */
-        Collection<String> candidates = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+        Collection<String> candidates = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
         candidates.add(SshdSocketAddress.toAddressString(remoteAddress));
         SocketAddress connectAddress = clientSession.getConnectAddress();
         candidates.add(SshdSocketAddress.toAddressString(connectAddress));

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtension.java
index 61fe34a..640f5c0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtension.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractCheckFileExtension.java
@@ -71,6 +71,6 @@ public abstract class AbstractCheckFileExtension extends AbstractSftpClientExten
             hashes.add(hashValue);
         }
 
-        return new Pair<String, Collection<byte[]>>(algo, hashes);
+        return new Pair<>(algo, hashes);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java b/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
index 707cb81..757f709 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
@@ -107,7 +107,7 @@ public final class SyspropsMapWrapper implements Map<String, Object> {
         Properties props = System.getProperties();
         // return a copy in order to avoid concurrent modifications
         Set<Entry<String, Object>> entries =
-                new TreeSet<Entry<String, Object>>(Pair.byKeyEntryComparator());
+                new TreeSet<>(Pair.byKeyEntryComparator());
         for (String key : props.stringPropertyNames()) {
             if (!isMappedSyspropKey(key)) {
                 continue;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/channel/BufferedIoOutputStream.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/BufferedIoOutputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/BufferedIoOutputStream.java
index d496e24..6bacdc8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/BufferedIoOutputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/BufferedIoOutputStream.java
@@ -35,8 +35,8 @@ import org.apache.sshd.common.util.closeable.AbstractInnerCloseable;
  */
 public class BufferedIoOutputStream extends AbstractInnerCloseable implements IoOutputStream {
     protected final IoOutputStream out;
-    protected final Queue<IoWriteFutureImpl> writes = new ConcurrentLinkedQueue<IoWriteFutureImpl>();
-    protected final AtomicReference<IoWriteFutureImpl> currentWrite = new AtomicReference<IoWriteFutureImpl>();
+    protected final Queue<IoWriteFutureImpl> writes = new ConcurrentLinkedQueue<>();
+    protected final AtomicReference<IoWriteFutureImpl> currentWrite = new AtomicReference<>();
 
     public BufferedIoOutputStream(IoOutputStream out) {
         this.out = out;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
index 355a469..b7ee317 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
@@ -41,8 +41,8 @@ public final class SttySupport {
     public static final String DEFAULT_SSHD_STTY_COMMAND = "stty";
 
     private static final AtomicReference<String> STTY_COMMAND_HOLDER =
-            new AtomicReference<String>(System.getProperty(SSHD_STTY_COMMAND_PROP, DEFAULT_SSHD_STTY_COMMAND));
-    private static final AtomicReference<String> TTY_PROPS_HOLDER = new AtomicReference<String>(null);
+            new AtomicReference<>(System.getProperty(SSHD_STTY_COMMAND_PROP, DEFAULT_SSHD_STTY_COMMAND));
+    private static final AtomicReference<String> TTY_PROPS_HOLDER = new AtomicReference<>(null);
     private static final AtomicLong TTY_PROPS_LAST_FETCHED_HOLDER = new AtomicLong(0L);
 
     private SttySupport() {
@@ -54,7 +54,7 @@ public final class SttySupport {
     }
 
     public static Map<PtyMode, Integer> parsePtyModes(String stty) {
-        Map<PtyMode, Integer> modes = new TreeMap<PtyMode, Integer>();
+        Map<PtyMode, Integer> modes = new TreeMap<>();
         for (PtyMode mode : PtyMode.values()) {
             if (mode == PtyMode.TTY_OP_ISPEED || mode == PtyMode.TTY_OP_OSPEED) {
                 // TODO ...

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java b/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java
index 83e9003..9266ae9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java
@@ -102,7 +102,7 @@ public enum TimeValueConfig {
         }
 
         int lastPos = 0;
-        Map<TimeValueConfig, Long> spec = new EnumMap<TimeValueConfig, Long>(TimeValueConfig.class);
+        Map<TimeValueConfig, Long> spec = new EnumMap<>(TimeValueConfig.class);
         for (int curPos = 0; curPos < s.length(); curPos++) {
             char ch = s.charAt(curPos);
             if ((ch >= '0') && (ch <= '9')) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java
index acf7e80..66d1aa3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java
@@ -148,7 +148,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
             return Collections.emptyList();
         }
 
-        List<PublicKey> keys = new ArrayList<PublicKey>(entries.size());
+        List<PublicKey> keys = new ArrayList<>(entries.size());
         for (AuthorizedKeyEntry e : entries) {
             PublicKey k = e.resolvePublicKey(fallbackResolver);
             if (k != null) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
index fb581be..9a04394 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/SocksProxy.java
@@ -43,7 +43,7 @@ import org.apache.sshd.common.util.net.SshdSocketAddress;
 public class SocksProxy extends AbstractCloseable implements IoHandler {
 
     private final ConnectionService service;
-    private final Map<IoSession, Proxy> proxies = new ConcurrentHashMap<IoSession, Proxy>();
+    private final Map<IoSession, Proxy> proxies = new ConcurrentHashMap<>();
 
     public SocksProxy(ConnectionService service) {
         this.service = service;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
index 75d8e08..1991e99 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
@@ -66,7 +66,7 @@ public abstract class AbstractFileKeyPairProvider extends AbstractResourceKeyPai
 
     public void setPaths(Collection<? extends Path> paths) {
         int numPaths = GenericUtils.size(paths);
-        Collection<Path> resolved = (numPaths <= 0) ? Collections.emptyList() : new ArrayList<Path>(paths.size());
+        Collection<Path> resolved = (numPaths <= 0) ? Collections.emptyList() : new ArrayList<>(paths.size());
         // use absolute path in order to have unique cache keys
         if (numPaths > 0) {
             for (Path p : paths) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
index 0b316c0..60a2750 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
@@ -90,7 +90,7 @@ public class MappedKeyPairProvider implements KeyPairProvider {
             return Collections.emptyMap();
         }
 
-        Map<String, KeyPair> pairsMap = new TreeMap<String, KeyPair>(String.CASE_INSENSITIVE_ORDER);
+        Map<String, KeyPair> pairsMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         for (KeyPair kp : pairs) {
             String keyType = ValidateUtils.checkNotNullAndNotEmpty(KeyUtils.getKeyType(kp), "Cannot determine key type");
             KeyPair prev = pairsMap.put(keyType, kp);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
index b1d95fa..98025d7 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
@@ -32,7 +32,7 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
  * @see org.apache.sshd.common.session.helpers.AbstractSession#checkForTimeouts()
  */
 public class SessionTimeoutListener extends AbstractLoggingBean implements SessionListener, Runnable {
-    private final Set<AbstractSession> sessions = new CopyOnWriteArraySet<AbstractSession>();
+    private final Set<AbstractSession> sessions = new CopyOnWriteArraySet<>();
 
     public SessionTimeoutListener() {
         super();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
index 0333fd1..b0d6a21 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
@@ -479,7 +479,7 @@ public final class SftpHelper {
     }
 
     public static Map<String, Object> readAttrs(Buffer buffer, int version) {
-        Map<String, Object> attrs = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
+        Map<String, Object> attrs = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         int flags = buffer.getInt();
         if (version >= SftpConstants.SFTP_V4) {
             int type = buffer.getUByte();
@@ -592,7 +592,7 @@ public final class SftpHelper {
     public static Map<String, byte[]> readExtensions(Buffer buffer) {
         int count = buffer.getInt();
         // NOTE
-        Map<String, byte[]> extended = new TreeMap<String, byte[]>(String.CASE_INSENSITIVE_ORDER);
+        Map<String, byte[]> extended = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         for (int i = 0; i < count; i++) {
             String key = buffer.getString();
             byte[] val = buffer.getBytes();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
index e9ccf97..2930f84 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
@@ -150,7 +150,7 @@ public class AclSupportedParser extends AbstractParser<AclCapabilities> {
                 return Collections.emptySet();
             }
 
-            Set<String> caps = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+            Set<String> caps = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
             Map<Integer, String> map = getAclCapabilityValuesMap();
             for (Map.Entry<Integer, String> ae : map.entrySet()) {
                 Integer value = ae.getKey();
@@ -182,7 +182,7 @@ public class AclSupportedParser extends AbstractParser<AclCapabilities> {
             }
 
             Map<Integer, String> map = getAclCapabilityValuesMap();
-            Set<Integer> caps = new HashSet<Integer>(map.size());
+            Set<Integer> caps = new HashSet<>(map.size());
             for (Integer v : map.keySet()) {
                 if ((mask & v) != 0) {
                     caps.add(v);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/ParserUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/ParserUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/ParserUtils.java
index 243d299..ed39577 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/ParserUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/ParserUtils.java
@@ -132,7 +132,7 @@ public final class ParserUtils {
             if (PARSERS_MAP.isEmpty()) {
                 return Collections.emptyList();
             } else { // return a copy in order to avoid concurrent modification issues
-                return new ArrayList<ExtensionParser<?>>(PARSERS_MAP.values());
+                return new ArrayList<>(PARSERS_MAP.values());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
index 6c343c4..a02d553 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
@@ -522,7 +522,7 @@ public final class SelectorUtils {
     }
 
     public static List<String> tokenizePath(String path, String separator) {
-        List<String> ret = new ArrayList<String>();
+        List<String> ret = new ArrayList<>();
         StringTokenizer st = new StringTokenizer(path, separator);
         while (st.hasMoreTokens()) {
             ret.add(st.nextToken());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/Builder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/Builder.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/Builder.java
index 58c8819..9dad9b0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/Builder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/Builder.java
@@ -34,7 +34,7 @@ import org.apache.sshd.common.util.ValidateUtils;
 public final class Builder implements ObjectBuilder<Closeable> {
 
     private final Object lock;
-    private final List<Closeable> closeables = new ArrayList<Closeable>();
+    private final List<Closeable> closeables = new ArrayList<>();
 
     public Builder(Object lock) {
         this.lock = ValidateUtils.checkNotNull(lock, "No lock");
@@ -69,7 +69,7 @@ public final class Builder implements ObjectBuilder<Closeable> {
 
     @SuppressWarnings("rawtypes")
     public <T extends SshFuture> Builder when(final Iterable<? extends SshFuture<T>> futures) {
-        return close(new FuturesCloseable<T>(lock, futures));
+        return close(new FuturesCloseable<>(lock, futures));
     }
 
     public Builder sequential(Closeable... closeables) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
index ebca9f2..da3aace 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
@@ -230,7 +230,7 @@ public class ModifiableFileWatcher extends AbstractLoggingBean {
         if (OsUtils.isUNIX()) {
             PosixFilePermission p = IoUtils.validateExcludedPermissions(perms, STRICTLY_PROHIBITED_FILE_PERMISSION);
             if (p != null) {
-                return new Pair<String, Object>(String.format("Permissions violation (%s)", p), p);
+                return new Pair<>(String.format("Permissions violation (%s)", p), p);
             }
         }
 
@@ -251,7 +251,7 @@ public class ModifiableFileWatcher extends AbstractLoggingBean {
         }
 
         if (!expected.contains(owner)) {
-            return new Pair<String, Object>(String.format("Owner violation (%s)", owner), owner);
+            return new Pair<>(String.format("Owner violation (%s)", owner), owner);
         }
 
         return null;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java b/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
index 65252a0..e56c290 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
@@ -166,7 +166,7 @@ public class SshdSocketAddress extends SocketAddress {
      * or localhost sorted according to {@link #BY_HOST_ADDRESS}
      */
     public static List<InetAddress> getExternalNetwork4Addresses() {
-        List<InetAddress> addresses = new ArrayList<InetAddress>();
+        List<InetAddress> addresses = new ArrayList<>();
         try {
             for (Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); (nets != null) && nets.hasMoreElements();) {
                 NetworkInterface netint = nets.nextElement();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
index 777f14e..4f61d46 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
@@ -139,7 +139,7 @@ public final class ThreadUtils {
     public static ExecutorService newFixedThreadPool(String poolName, int nThreads) {
         return new ThreadPoolExecutor(nThreads, nThreads,
                 0L, TimeUnit.MILLISECONDS, // TODO make this configurable
-                new LinkedBlockingQueue<Runnable>(),
+                new LinkedBlockingQueue<>(),
                 new SshdThreadFactory(poolName),
                 new ThreadPoolExecutor.CallerRunsPolicy());
     }
@@ -147,7 +147,7 @@ public final class ThreadUtils {
     public static ExecutorService newCachedThreadPool(String poolName) {
         return new ThreadPoolExecutor(0, Integer.MAX_VALUE, // TODO make this configurable
                 60L, TimeUnit.SECONDS, // TODO make this configurable
-                new SynchronousQueue<Runnable>(),
+                new SynchronousQueue<>(),
                 new SshdThreadFactory(poolName),
                 new ThreadPoolExecutor.CallerRunsPolicy());
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
index 9177966..08b0975 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
@@ -97,7 +97,7 @@ public class UserAuthKeyboardInteractive extends AbstractUserAuth {
             }
 
             int num = buffer.getInt();
-            List<String> responses = (num <= 0) ? Collections.emptyList() : new ArrayList<String>(num);
+            List<String> responses = (num <= 0) ? Collections.emptyList() : new ArrayList<>(num);
             for (int index = 0; index < num; index++) {
                 String value = buffer.getString();
                 if (log.isTraceEnabled()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
index 70cb3be..45af83f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
@@ -38,7 +38,7 @@ import org.apache.sshd.server.session.ServerSession;
 public class CachingPublicKeyAuthenticator extends AbstractLoggingBean implements PublickeyAuthenticator, SessionListener {
 
     protected final PublickeyAuthenticator authenticator;
-    protected final Map<ServerSession, Map<PublicKey, Boolean>> cache = new ConcurrentHashMap<ServerSession, Map<PublicKey, Boolean>>();
+    protected final Map<ServerSession, Map<PublicKey, Boolean>> cache = new ConcurrentHashMap<>();
 
     public CachingPublicKeyAuthenticator(PublickeyAuthenticator authenticator) {
         this.authenticator = ValidateUtils.checkNotNull(authenticator, "No delegate authenticator");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
index a978b06..050a0ab 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
@@ -64,7 +64,7 @@ public class AuthorizedKeysAuthenticator extends ModifiableFileWatcher implement
     }
 
     private final AtomicReference<PublickeyAuthenticator> delegateHolder =  // assumes initially reject-all
-            new AtomicReference<PublickeyAuthenticator>(RejectAllPublickeyAuthenticator.INSTANCE);
+            new AtomicReference<>(RejectAllPublickeyAuthenticator.INSTANCE);
 
     public AuthorizedKeysAuthenticator(File file) {
         this(ValidateUtils.checkNotNull(file, "No file to watch").toPath());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java b/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java
index c67b451..2a30525 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java
@@ -47,7 +47,7 @@ public final class Moduli {
     }
 
     public static List<DhGroup> parseModuli(URL url) throws IOException {
-        List<DhGroup> groups = new ArrayList<DhGroup>();
+        List<DhGroup> groups = new ArrayList<>();
         try (BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream()))) {
             String line;
             while ((line = r.readLine()) != null) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java b/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java
index 071af07..3b92cc2 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java
@@ -148,7 +148,7 @@ public class GitPackCommand implements Command, Runnable {
             value = "";
         }
 
-        List<String> list = new ArrayList<String>();
+        List<String> list = new ArrayList<>();
 
         StringBuilder sb = new StringBuilder();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java b/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java
index dfcc6ab..0b1f3c7 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/pgm/EmbeddedCommandRunner.java
@@ -64,7 +64,7 @@ public class EmbeddedCommandRunner {
     private TextBuiltin subcommand;
 
     @Argument(index = 1, metaVar = "metaVar_arg")
-    private List<String> arguments = new ArrayList<String>();
+    private List<String> arguments = new ArrayList<>();
 
     private String rootDir;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java
----------------------------------------------------------------------
diff --git a/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java b/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java
index 04bfc0c..ed508d8 100644
--- a/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java
+++ b/sshd-ldap/src/main/java/org/apache/sshd/common/util/net/LdapNetworkConnector.java
@@ -86,7 +86,7 @@ public class LdapNetworkConnector<C> extends NetworkConnector {
            + ",crossCertificatePair,x500UniqueIdentifier";
 
     protected final SearchControls searchControls = new SearchControls();
-    protected final Map<String, Object> ldapEnv = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
+    protected final Map<String, Object> ldapEnv = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
     protected MessageFormat bindDNPattern = new MessageFormat(DEFAULT_LDAP_BIND_DN_PATTERN);
     protected MessageFormat bindPasswordPattern = new MessageFormat(DEFAULT_LDAP_BIND_PASSWORD_PATTERN);
     protected MessageFormat searchFilterPattern;
@@ -347,7 +347,7 @@ public class LdapNetworkConnector<C> extends NetworkConnector {
      */
     public Map<String, Object> resolveAttributes(String username, String password, C queryContext) throws NamingException {
         // create a copy of the original environment so we can change it
-        DirContext context = initializeDirContext(queryContext, new HashMap<String, Object>(ldapEnv), username, password);
+        DirContext context = initializeDirContext(queryContext, new HashMap<>(ldapEnv), username, password);
         try {
             return queryAttributes(queryContext, context, context.getEnvironment(), username, password);
         } finally {
@@ -374,7 +374,7 @@ public class LdapNetworkConnector<C> extends NetworkConnector {
                                ValidateUtils.checkNotNullAndNotEmpty(filter, "No filter"),
                                searchControls);
         try {
-            Map<String, Object> attrsMap = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
+            Map<String, Object> attrsMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
             String referralMode = Objects.toString(ldapConfig.get(Context.REFERRAL), null);
             for (int index = 0;; index++) {
                 if (!result.hasMore()) {
@@ -516,7 +516,7 @@ public class LdapNetworkConnector<C> extends NetworkConnector {
         if (prev instanceof List<?>) {
             values = (List<Object>) prev;
         } else {
-            values = new ArrayList<Object>();
+            values = new ArrayList<>();
             values.add(prev);
             attrsMap.put(attrID, values);
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/195874b4/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java b/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
index 6a3d5a0..b0b07fb 100644
--- a/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
+++ b/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
@@ -165,7 +165,7 @@ public class LdapPublickeyAuthenticator extends LdapAuthenticator implements Pub
         // handle case of multi-valued attribute
         if (keyData instanceof Collection<?>) {
             Collection<?> values = (Collection<?>) keyData;
-            List<PublicKey> keys = new ArrayList<PublicKey>(values.size());
+            List<PublicKey> keys = new ArrayList<>(values.size());
             for (Object v : values) {
                 PublicKey k = parsePublicKeyValue(username, expected, session, attrs, v);
                 if (k == null) {


[16/16] mina-sshd git commit: [SSHD-698] Use lambda and method references, streams Deprecate Utils inner classes and use interface methods instead.

Posted by gn...@apache.org.
[SSHD-698] Use lambda and method references, streams
Deprecate Utils inner classes and use interface methods instead.


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/977b7b52
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/977b7b52
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/977b7b52

Branch: refs/heads/master
Commit: 977b7b529e1dba7f24fde674ba16aa451912cd0b
Parents: 0fde885
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Sep 15 11:29:48 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Sep 15 21:31:08 2016 +0200

----------------------------------------------------------------------
 pom.xml                                         |   2 +-
 .../apache/sshd/agent/SshAgentConstants.java    |  15 +-
 .../org/apache/sshd/agent/local/AgentImpl.java  |   6 +-
 .../agent/local/ChannelAgentForwarding.java     |   9 +-
 .../org/apache/sshd/agent/unix/AgentServer.java |  20 +-
 .../sshd/agent/unix/AgentServerProxy.java       |  50 ++--
 .../sshd/agent/unix/ChannelAgentForwarding.java |  33 +--
 .../client/ClientAuthenticationManager.java     |   4 +-
 .../org/apache/sshd/client/ClientBuilder.java   |  32 +--
 .../java/org/apache/sshd/client/SshClient.java  | 149 ++++-------
 .../java/org/apache/sshd/client/SshKeyScan.java |   8 +-
 .../auth/AuthenticationIdentitiesProvider.java  | 157 ++++++-----
 .../client/auth/BuiltinUserAuthFactories.java   |   2 +-
 .../auth/hostbased/HostKeyIdentityProvider.java |  48 ++--
 .../auth/hostbased/UserAuthHostBased.java       |   4 +-
 .../keyboard/UserAuthKeyboardInteractive.java   |   2 +-
 .../auth/password/PasswordIdentityProvider.java | 267 +++++++++---------
 .../client/auth/password/UserAuthPassword.java  |   2 +-
 .../client/auth/pubkey/KeyPairIdentity.java     |   4 +-
 .../auth/pubkey/UserAuthPublicKeyIterator.java  |   2 +-
 .../client/channel/AbstractClientChannel.java   |  42 ++-
 .../sshd/client/channel/ChannelSession.java     |   7 +-
 .../sshd/client/channel/ChannelSubsystem.java   |   9 +-
 .../channel/PtyCapableChannelSession.java       |  22 +-
 .../client/config/hosts/HostConfigEntry.java    |  29 +-
 .../client/config/hosts/KnownHostDigest.java    |   2 +-
 .../keys/BuiltinClientIdentitiesWatcher.java    |  14 +-
 .../config/keys/ClientIdentitiesWatcher.java    |   7 +-
 .../sshd/client/config/keys/ClientIdentity.java |   7 +-
 .../org/apache/sshd/client/kex/DHGClient.java   |   8 +-
 .../org/apache/sshd/client/kex/DHGEXClient.java |  10 +-
 .../sshd/client/scp/AbstractScpClient.java      |  22 +-
 .../client/session/AbstractClientSession.java   |  16 +-
 .../client/session/ClientConnectionService.java |   7 +-
 .../client/session/ClientUserAuthService.java   |   4 +-
 .../client/simple/AbstractSimpleClient.java     | 165 +++---------
 .../AbstractSimpleClientSessionCreator.java     |   2 +-
 .../sshd/client/simple/SimpleSessionClient.java |  34 ++-
 .../sshd/client/simple/SimpleSftpClient.java    |  34 ++-
 .../subsystem/sftp/AbstractSftpClient.java      |   1 +
 .../subsystem/sftp/DefaultSftpClient.java       |  18 +-
 .../subsystem/sftp/SftpClientCreator.java       |   2 +-
 .../client/subsystem/sftp/SftpFileSystem.java   |   5 +-
 .../subsystem/sftp/SftpFileSystemProvider.java  |  18 +-
 .../subsystem/sftp/SftpPosixFileAttributes.java |   1 +
 .../subsystem/sftp/SftpVersionSelector.java     | 188 ++++++-------
 .../extensions/BuiltinSftpClientExtensions.java |   2 +-
 .../helpers/AbstractSftpClientExtension.java    |   4 +-
 .../org/apache/sshd/common/AttributeStore.java  |  95 ++++---
 .../org/apache/sshd/common/BaseBuilder.java     |   6 +-
 .../org/apache/sshd/common/BuiltinFactory.java  |  21 +-
 .../java/org/apache/sshd/common/Closeable.java  |  43 +++
 .../org/apache/sshd/common/NamedFactory.java    |  67 ++---
 .../org/apache/sshd/common/NamedResource.java   | 144 +++++-----
 .../org/apache/sshd/common/OptionalFeature.java |  69 ++---
 .../org/apache/sshd/common/ServiceFactory.java  |  39 +--
 .../org/apache/sshd/common/SshConstants.java    |  25 +-
 .../apache/sshd/common/SyspropsMapWrapper.java  |  38 +--
 .../sshd/common/channel/AbstractChannel.java    |  23 +-
 .../common/channel/ChannelRequestHandler.java   |   8 +-
 .../org/apache/sshd/common/channel/PtyMode.java |  14 +-
 .../apache/sshd/common/channel/SttySupport.java |   4 +-
 .../org/apache/sshd/common/channel/Window.java  |  20 +-
 .../sshd/common/cipher/BuiltinCiphers.java      |   4 +-
 .../org/apache/sshd/common/cipher/Cipher.java   |  41 +--
 .../org/apache/sshd/common/cipher/ECCurves.java |  57 ++--
 .../common/compression/BuiltinCompressions.java |   2 +-
 .../config/NamedFactoriesListParseResult.java   |   2 +-
 .../config/NamedResourceListParseResult.java    |   2 +-
 .../sshd/common/config/SshConfigFileReader.java |  10 +-
 .../common/config/keys/BuiltinIdentities.java   |  13 +-
 .../sshd/common/config/keys/KeyUtils.java       |   1 +
 .../sshd/common/config/keys/PublicKeyEntry.java |   4 +-
 .../sshd/common/digest/BuiltinDigests.java      |   2 +-
 .../sshd/common/file/util/BaseFileSystem.java   |   9 +-
 .../sshd/common/file/util/MockFileSystem.java   |   1 +
 .../common/forward/DefaultTcpipForwarder.java   |  37 +--
 .../common/forward/LocalForwardingEntry.java    |   2 +-
 .../apache/sshd/common/forward/SocksProxy.java  |  15 +-
 .../global/AbstractOpenSshHostKeysHandler.java  |   4 +-
 .../common/helpers/AbstractFactoryManager.java  |   2 +-
 .../io/BuiltinIoServiceFactoryFactories.java    |   2 +-
 .../sshd/common/io/mina/MinaConnector.java      |  17 +-
 .../apache/sshd/common/io/mina/MinaSession.java |  23 +-
 .../common/io/nio2/Nio2CompletionHandler.java   |  18 +-
 .../apache/sshd/common/io/nio2/Nio2Service.java |   3 +-
 .../sshd/common/kex/BuiltinDHFactories.java     |   2 +-
 .../java/org/apache/sshd/common/kex/DHG.java    |   1 +
 .../sshd/common/kex/KexFactoryManager.java      |  12 +-
 .../sshd/common/kex/KexProposalOption.java      |  32 +--
 .../org/apache/sshd/common/kex/KeyExchange.java |  45 +++-
 .../AbstractFileKeyPairProvider.java            |  22 +-
 .../keyprovider/AbstractKeyPairProvider.java    |  37 +--
 .../AbstractResourceKeyPairProvider.java        |  11 +-
 .../common/keyprovider/KeyIdentityProvider.java | 268 ++++++++++---------
 .../common/keyprovider/KeyPairProvider.java     | 118 ++++----
 .../keyprovider/MappedKeyPairProvider.java      |   7 +-
 .../org/apache/sshd/common/mac/BuiltinMacs.java |   2 +-
 .../org/apache/sshd/common/scp/ScpHelper.java   |  78 +++---
 .../ConnectionServiceRequestHandler.java        |   2 +-
 .../helpers/AbstractConnectionService.java      |  74 +++--
 .../common/session/helpers/AbstractSession.java |  86 +++---
 .../session/helpers/SessionTimeoutListener.java |   1 +
 .../common/signature/BuiltinSignatures.java     |   2 +-
 .../signature/SignatureFactoriesManager.java    |   4 +-
 .../common/subsystem/sftp/SftpConstants.java    |  19 +-
 .../sftp/SftpUniversalOwnerAndGroup.java        |   2 +-
 .../sshd/common/util/EventListenerUtils.java    | 117 ++++----
 .../apache/sshd/common/util/GenericUtils.java   | 256 +++++++++++++-----
 .../sshd/common/util/Int2IntFunction.java       |  73 +++--
 .../apache/sshd/common/util/NumberUtils.java    |  18 +-
 .../java/org/apache/sshd/common/util/Pair.java  |  16 +-
 .../sshd/common/util/ReflectionUtils.java       |   7 +-
 .../apache/sshd/common/util/SelectorUtils.java  |   4 +-
 .../apache/sshd/common/util/Transformer.java    |  37 +--
 .../apache/sshd/common/util/ValidateUtils.java  |   6 +
 .../apache/sshd/common/util/buffer/Buffer.java  |   4 +-
 .../sshd/common/util/buffer/BufferUtils.java    |   7 +-
 .../util/buffer/keys/BufferPublicKeyParser.java |  71 ++---
 .../util/closeable/AbstractCloseable.java       |  14 +-
 .../util/closeable/AbstractInnerCloseable.java  |   9 +-
 .../common/util/closeable/CloseableUtils.java   |  25 +-
 .../common/util/closeable/FuturesCloseable.java |  18 +-
 .../common/util/closeable/IoBaseCloseable.java  |  13 -
 .../util/closeable/ParallelCloseable.java       |  18 +-
 .../util/io/CloseableEmptyInputStream.java      |   1 +
 .../sshd/common/util/io/FileInfoExtractor.java  |  50 +---
 .../org/apache/sshd/common/util/io/IoUtils.java |   3 +-
 .../sshd/common/util/io/LimitInputStream.java   |   1 +
 .../sshd/common/util/io/NullInputStream.java    |   1 +
 .../sshd/common/util/io/NullOutputStream.java   |   1 +
 .../sshd/common/util/logging/LoggingUtils.java  |  46 ++--
 .../sshd/common/util/logging/SimplifiedLog.java |   1 -
 .../sshd/common/util/net/SshdSocketAddress.java |  21 +-
 .../sshd/common/util/threads/ThreadUtils.java   |   9 +-
 .../server/ServerAuthenticationManager.java     | 129 +++++----
 .../org/apache/sshd/server/ServerBuilder.java   |  27 +-
 .../java/org/apache/sshd/server/Signal.java     |  26 +-
 .../java/org/apache/sshd/server/SshServer.java  |  56 ++--
 .../server/auth/BuiltinUserAuthFactories.java   |   2 +-
 .../sshd/server/auth/gss/CredentialHelper.java  |   1 +
 .../sshd/server/auth/gss/GSSAuthenticator.java  |   1 +
 .../auth/hostbased/UserAuthHostBased.java       |   2 +-
 .../pubkey/CachingPublicKeyAuthenticator.java   |   2 +-
 .../server/auth/pubkey/UserAuthPublicKey.java   |   4 +-
 .../sshd/server/channel/ChannelSession.java     |  34 +--
 .../keys/AuthorizedKeysAuthenticator.java       |   2 +-
 .../sshd/server/config/keys/ServerIdentity.java |   7 +-
 .../sshd/server/forward/ForwardingFilter.java   |   2 +-
 .../sshd/server/forward/TcpipServerChannel.java |  50 ++--
 .../global/CancelTcpipForwardHandler.java       |   2 +-
 .../server/global/OpenSshHostKeysHandler.java   |   4 +-
 .../sshd/server/global/TcpipForwardHandler.java |   2 +-
 .../server/jaas/JaasPasswordAuthenticator.java  |  21 +-
 .../org/apache/sshd/server/kex/DHGEXServer.java |   8 +-
 .../org/apache/sshd/server/kex/DHGServer.java   |   6 +-
 .../server/session/AbstractServerSession.java   |  12 +-
 .../server/session/ServerUserAuthService.java   |  21 +-
 .../sshd/server/shell/InvertedShellWrapper.java |   7 +-
 .../sshd/server/shell/ProcessShellFactory.java  |   1 +
 .../server/shell/TtyFilterOutputStream.java     |   3 +-
 .../sshd/server/subsystem/sftp/Handle.java      |   1 +
 .../server/subsystem/sftp/SftpSubsystem.java    |  84 ++----
 .../subsystem/sftp/SftpSubsystemFactory.java    |  18 +-
 .../java/org/apache/sshd/KeyReExchangeTest.java |  27 +-
 .../src/test/java/org/apache/sshd/LoadTest.java |  26 +-
 .../java/org/apache/sshd/WindowAdjustTest.java  |  59 ++--
 .../client/ClientAuthenticationManagerTest.java |   2 +-
 .../sshd/client/ClientSessionListenerTest.java  |  11 +-
 .../java/org/apache/sshd/client/ClientTest.java | 119 +++-----
 .../auth/PasswordIdentityProviderTest.java      |   4 +-
 .../sshd/client/channel/ChannelExecTest.java    |  19 +-
 .../hosts/HostConfigEntryResolverTest.java      |  49 ++--
 .../client/config/keys/ClientIdentityTest.java  |   2 +-
 .../KnownHostsServerKeyVerifierTest.java        |  24 +-
 .../org/apache/sshd/client/scp/ScpTest.java     |   5 +-
 .../sshd/client/session/ClientSessionTest.java  |  54 ++--
 .../client/simple/SimpleSessionClientTest.java  |  33 +--
 .../sftp/AbstractSftpClientTestSupport.java     |   2 +-
 .../sftp/DefaultCloseableHandleTest.java        |  26 +-
 .../subsystem/sftp/SftpFileSystemTest.java      |  60 ++---
 .../sshd/client/subsystem/sftp/SftpTest.java    |  40 +--
 .../subsystem/sftp/SftpVersionSelectorTest.java |  13 +-
 .../client/subsystem/sftp/SftpVersionsTest.java |  32 +--
 .../helpers/AbstractCheckFileExtensionTest.java |  56 ++--
 .../helpers/AbstractMD5HashExtensionTest.java   |   8 +-
 .../apache/sshd/common/AttributeStoreTest.java  |  45 ++--
 .../org/apache/sshd/common/SshBuilderTest.java  |   2 +-
 .../sshd/common/auth/AuthenticationTest.java    | 135 ++++------
 .../common/auth/SinglePublicKeyAuthTest.java    |  44 ++-
 .../channel/ChannelPipedOutputStreamTest.java   |  22 +-
 .../apache/sshd/common/channel/WindowTest.java  |   4 +-
 .../sshd/common/cipher/BuiltinCiphersTest.java  |   8 +-
 .../apache/sshd/common/cipher/CipherTest.java   |  23 +-
 .../compression/BuiltinCompressionsTest.java    |   6 +-
 .../common/compression/CompressionTest.java     |   4 +-
 .../common/config/SshConfigFileReaderTest.java  |   8 +-
 .../sshd/common/config/TimeValueConfigTest.java |  10 +-
 .../config/keys/AuthorizedKeysTestSupport.java  |   2 +-
 .../common/config/keys/KeyRandomArtTest.java    |   9 +-
 .../KeyUtilsFingerprintCaseSensitivityTest.java |   2 +-
 .../keys/KeyUtilsFingerprintGenerationTest.java |   4 +-
 .../sshd/common/config/keys/KeyUtilsTest.java   |   4 +-
 .../file/root/RootedFileSystemProviderTest.java |   8 +-
 .../common/forward/PortForwardingLoadTest.java  |   9 +-
 .../sshd/common/forward/PortForwardingTest.java |  25 +-
 .../common/future/DefaultSshFutureTest.java     |  33 +--
 .../sshd/common/kex/BuiltinDHFactoriesTest.java |   6 +-
 .../sshd/common/kex/KexFactoryManagerTest.java  |   8 +-
 .../apache/sshd/common/kex/KeyExchangeTest.java |  15 +-
 .../common/keyprovider/KeyPairProviderTest.java |  16 +-
 .../apache/sshd/common/mac/BuiltinMacsTest.java |   6 +-
 .../org/apache/sshd/common/mac/MacTest.java     |  18 +-
 .../ReservedSessionMessagesHandlerTest.java     |  24 +-
 .../session/helpers/AbstractSessionTest.java    |  14 +-
 .../common/signature/BuiltinSignaturesTest.java |   6 +-
 .../signature/SignatureFactoriesTest.java       |  50 ++--
 .../sshd/common/signature/SignatureRSATest.java |  21 +-
 .../common/util/EventListenerUtilsTest.java     |   2 +-
 .../sshd/common/util/NumberUtilsTest.java       |   4 +-
 .../sshd/common/util/SecurityUtilsTest.java     |  10 +-
 .../sshd/common/util/TransformerTest.java       |   6 +-
 .../util/closeable/CloseableUtilsTest.java      |  13 +-
 .../apache/sshd/deprecated/UserAuthAgent.java   |   2 +-
 .../deprecated/UserAuthKeyboardInteractive.java |   2 +-
 .../sshd/deprecated/UserAuthPassword.java       |   2 +-
 .../sshd/deprecated/UserAuthPublicKey.java      |   4 +-
 .../server/ServerAuthenticationManagerTest.java |   2 +-
 .../sshd/server/ServerProxyAcceptorTest.java    |  10 +-
 .../sshd/server/ServerSessionListenerTest.java  |  12 +-
 .../java/org/apache/sshd/server/ServerTest.java | 146 +++++-----
 .../sshd/server/StandardEnvironmentTest.java    |   7 +-
 .../sshd/server/auth/WelcomeBannerTest.java     |   4 +-
 .../sshd/server/channel/ChannelSessionTest.java |  11 +-
 .../server/config/keys/ServerIdentityTest.java  |   4 +-
 .../jaas/JaasPasswordAuthenticatorTest.java     |   2 +-
 .../server/shell/TtyFilterInputStreamTest.java  |  18 +-
 .../apache/sshd/spring/SpringConfigTest.java    |   1 -
 .../sshd/util/test/AsyncEchoShellFactory.java   |  36 +--
 .../apache/sshd/util/test/BaseTestSupport.java  |   2 +-
 .../util/test/BogusPasswordAuthenticator.java   |   2 +-
 .../org/apache/sshd/util/test/JSchLogger.java   |   1 -
 .../java/org/apache/sshd/util/test/Utils.java   |   9 +-
 .../common/util/net/LdapNetworkConnector.java   |   2 +-
 .../sshd/server/auth/BaseAuthenticatorTest.java |   2 +-
 245 files changed, 2639 insertions(+), 3529 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 067142a..1d4b678 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,7 +110,7 @@
 
         <bouncycastle.version>1.54</bouncycastle.version>
         <slf4j.version>1.7.21</slf4j.version>
-        <spring.version>3.0.6.RELEASE</spring.version>
+        <spring.version>3.2.17.RELEASE</spring.version>
         <jgit.version>3.4.1.201406201815-r</jgit.version>
         <junit.version>4.12</junit.version>
         <surefire.plugin.version>2.19.1</surefire.plugin.version>

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/agent/SshAgentConstants.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/SshAgentConstants.java b/sshd-core/src/main/java/org/apache/sshd/agent/SshAgentConstants.java
index aecf89d..3c86197 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/SshAgentConstants.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/SshAgentConstants.java
@@ -18,9 +18,7 @@
  */
 package org.apache.sshd.agent;
 
-import java.lang.reflect.Field;
 import java.util.Map;
-import java.util.function.Predicate;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.logging.LoggingUtils;
@@ -76,16 +74,11 @@ public final class SshAgentConstants {
 
     private static class LazyMessagesMapHolder {
         private static final Map<Integer, String> MESSAGES_MAP =
-                LoggingUtils.generateMnemonicMap(SshAgentConstants.class, new Predicate<Field>() {
-                    @Override
-                    public boolean test(Field f) {
-                        String name = f.getName();
-                        if (name.startsWith("SSH_AGENT_CONSTRAIN")) {
-                            return false;
-                        }
+                LoggingUtils.generateMnemonicMap(SshAgentConstants.class, f -> {
+                    String name = f.getName();
+                    return !name.startsWith("SSH_AGENT_CONSTRAIN")
+                            && (name.startsWith("SSH_AGENT") || name.startsWith("SSH2_AGENT"));
 
-                        return name.startsWith("SSH_AGENT") || name.startsWith("SSH2_AGENT");
-                    }
                 });
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentImpl.java b/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentImpl.java
index 3ccb551..6f7525f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentImpl.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentImpl.java
@@ -61,11 +61,7 @@ public class AgentImpl implements SshAgent {
             throw new SshException("Agent closed");
         }
 
-        List<Pair<PublicKey, String>> pks = new ArrayList<>();
-        for (Pair<KeyPair, String> kp : keys) {
-            pks.add(new Pair<>(kp.getFirst().getPublic(), kp.getSecond()));
-        }
-        return pks;
+        return GenericUtils.map(keys, kp -> new Pair<>(kp.getFirst().getPublic(), kp.getSecond()));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java b/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
index 9a2309c..c8e6395 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
@@ -31,7 +31,6 @@ import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.channel.ChannelListener;
 import org.apache.sshd.common.channel.ChannelOutputStream;
 import org.apache.sshd.common.future.CloseFuture;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
@@ -103,13 +102,7 @@ public class ChannelAgentForwarding extends AbstractServerChannel {
 
     @Override
     public CloseFuture close(boolean immediately) {
-        return super.close(immediately).addListener(new SshFutureListener<CloseFuture>() {
-            @Override
-            @SuppressWarnings("synthetic-access")
-            public void operationComplete(CloseFuture sshFuture) {
-                closeImmediately0();
-            }
-        });
+        return super.close(immediately).addListener(sshFuture -> closeImmediately0());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
index d4e6ea1..113ea23 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
@@ -95,19 +95,15 @@ public class AgentServer extends AbstractLoggingBean implements Closeable, Execu
         }
 
         ExecutorService executor = getExecutorService();
-        agentThread = executor.submit(new Runnable() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public void run() {
-                try {
-                    while (true) {
-                        long clientSock = Local.accept(handle);
-                        Socket.timeoutSet(clientSock, 10000000);    // TODO make this configurable
-                        new SshAgentSession(clientSock, agent).run();
-                    }
-                } catch (Exception e) {
-                    log.error("Failed to run session", e);
+        agentThread = executor.submit(() -> {
+            try {
+                while (true) {
+                    long clientSock = Local.accept(handle);
+                    Socket.timeoutSet(clientSock, 10000000);    // TODO make this configurable
+                    new SshAgentSession(clientSock, agent).run();
                 }
+            } catch (Exception e) {
+                log.error("Failed to run session", e);
             }
         });
         return authSocket;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
index cd0f22b..62b8e8f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
@@ -92,36 +92,32 @@ public class AgentServerProxy extends AbstractLoggingBean implements SshAgentSer
 
             pipeService = (executor == null) ? ThreadUtils.newSingleThreadExecutor("sshd-AgentServerProxy-PIPE-" + authSocket) : executor;
             pipeCloseOnExit = executor != pipeService || shutdownOnExit;
-            piper = pipeService.submit(new Runnable() {
-                @SuppressWarnings("synthetic-access")
-                @Override
-                public void run() {
-                    try {
-                        while (isOpen()) {
-                            try {
-                                long clientSock = Local.accept(handle);
-                                if (!isOpen()) {
-                                    break;
-                                }
-
-                                Session session = AgentServerProxy.this.service.getSession();
-                                Socket.timeoutSet(clientSock, PropertyResolverUtils.getIntProperty(session, AUTH_SOCKET_TIMEOUT, DEFAULT_AUTH_SOCKET_TIMEOUT));
-                                AgentForwardedChannel channel = new AgentForwardedChannel(clientSock);
-                                AgentServerProxy.this.service.registerChannel(channel);
-                                channel.open().verify(PropertyResolverUtils.getLongProperty(session, CHANNEL_OPEN_TIMEOUT_PROP, DEFAULT_CHANNEL_OPEN_TIMEOUT));
-                            } catch (Exception e) {
-                                if (log.isDebugEnabled()) {
-                                    log.debug("run(open={}) {} while authentication forwarding: {}",
-                                              isOpen(), e.getClass().getSimpleName(), e.getMessage());
-                                }
-                                if (log.isTraceEnabled()) {
-                                    log.trace("run(open=" + isOpen() + ") authentication forwarding failure details", e);
-                                }
+            piper = pipeService.submit(() -> {
+                try {
+                    while (isOpen()) {
+                        try {
+                            long clientSock = Local.accept(handle);
+                            if (!isOpen()) {
+                                break;
+                            }
+
+                            Session session = AgentServerProxy.this.service.getSession();
+                            Socket.timeoutSet(clientSock, PropertyResolverUtils.getIntProperty(session, AUTH_SOCKET_TIMEOUT, DEFAULT_AUTH_SOCKET_TIMEOUT));
+                            AgentForwardedChannel channel = new AgentForwardedChannel(clientSock);
+                            AgentServerProxy.this.service.registerChannel(channel);
+                            channel.open().verify(PropertyResolverUtils.getLongProperty(session, CHANNEL_OPEN_TIMEOUT_PROP, DEFAULT_CHANNEL_OPEN_TIMEOUT));
+                        } catch (Exception e) {
+                            if (log.isDebugEnabled()) {
+                                log.debug("run(open={}) {} while authentication forwarding: {}",
+                                          isOpen(), e.getClass().getSimpleName(), e.getMessage());
+                            }
+                            if (log.isTraceEnabled()) {
+                                log.trace("run(open=" + isOpen() + ") authentication forwarding failure details", e);
                             }
                         }
-                    } finally {
-                        innerFinished.set(true);
                     }
+                } finally {
+                    innerFinished.set(true);
                 }
             });
         } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
index ef28f34..e87b5e0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
@@ -32,7 +32,6 @@ import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.channel.ChannelListener;
 import org.apache.sshd.common.channel.ChannelOutputStream;
 import org.apache.sshd.common.future.CloseFuture;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
@@ -94,22 +93,18 @@ public class ChannelAgentForwarding extends AbstractServerChannel {
             ValidateUtils.checkTrue(copyBufSize >= MIN_FORWARDER_BUF_SIZE, "Copy buf size below min.: %d", copyBufSize);
             ValidateUtils.checkTrue(copyBufSize <= MAX_FORWARDER_BUF_SIZE, "Copy buf size above max.: %d", copyBufSize);
 
-            forwarder = forwardService.submit(new Runnable() {
-                @SuppressWarnings("synthetic-access")
-                @Override
-                public void run() {
-                    try {
-                        byte[] buf = new byte[copyBufSize];
-                        while (true) {
-                            int len = Socket.recv(handle, buf, 0, buf.length);
-                            if (len > 0) {
-                                out.write(buf, 0, len);
-                                out.flush();
-                            }
+            forwarder = forwardService.submit(() -> {
+                try {
+                    byte[] buf = new byte[copyBufSize];
+                    while (true) {
+                        int len = Socket.recv(handle, buf, 0, buf.length);
+                        if (len > 0) {
+                            out.write(buf, 0, len);
+                            out.flush();
                         }
-                    } catch (IOException e) {
-                        close(true);
                     }
+                } catch (IOException e) {
+                    close(true);
                 }
             });
 
@@ -175,13 +170,7 @@ public class ChannelAgentForwarding extends AbstractServerChannel {
 
     @Override
     public CloseFuture close(boolean immediately) {
-        return super.close(immediately).addListener(new SshFutureListener<CloseFuture>() {
-            @SuppressWarnings("synthetic-access")
-            @Override
-            public void operationComplete(CloseFuture sshFuture) {
-                closeImmediately0();
-            }
-        });
+        return super.close(immediately).addListener(sshFuture -> closeImmediately0());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java b/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
index ceb4105..0e0ff05 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
@@ -131,10 +131,10 @@ public interface ClientAuthenticationManager extends KeyPairProviderHolder {
      */
     List<NamedFactory<UserAuth>> getUserAuthFactories();
     default String getUserAuthFactoriesNameList() {
-        return NamedResource.Utils.getNames(getUserAuthFactories());
+        return NamedResource.getNames(getUserAuthFactories());
     }
     default List<String> getUserAuthFactoriesNames() {
-        return NamedResource.Utils.getNameList(getUserAuthFactories());
+        return NamedResource.getNameList(getUserAuthFactories());
     }
 
     void setUserAuthFactories(List<NamedFactory<UserAuth>> userAuthFactories);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java b/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
index 933ff42..00917b5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
@@ -19,7 +19,6 @@
 
 package org.apache.sshd.client;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
@@ -48,29 +47,22 @@ import org.apache.sshd.server.forward.ForwardedTcpipFactory;
  * SshClient builder
  */
 public class ClientBuilder extends BaseBuilder<SshClient, ClientBuilder> {
-    public static final Transformer<DHFactory, NamedFactory<KeyExchange>> DH2KEX =
-        new Transformer<DHFactory, NamedFactory<KeyExchange>>() {
-            @Override
-            public NamedFactory<KeyExchange> transform(DHFactory factory) {
-                if (factory == null) {
-                    return null;
-                } else if (factory.isGroupExchange()) {
-                    return DHGEXClient.newFactory(factory);
-                } else {
-                    return DHGClient.newFactory(factory);
-                }
-            }
-        };
+
+    public static final Transformer<DHFactory, NamedFactory<KeyExchange>> DH2KEX = factory ->
+            factory == null
+                ? null
+                : factory.isGroupExchange()
+                    ? DHGEXClient.newFactory(factory)
+                    : DHGClient.newFactory(factory);
 
     // Compression is not enabled by default for the client
     public static final List<CompressionFactory> DEFAULT_COMPRESSION_FACTORIES =
-            Collections.unmodifiableList(Arrays.<CompressionFactory>asList(BuiltinCompressions.none));
+            Collections.unmodifiableList(Collections.singletonList(BuiltinCompressions.none));
 
     public static final List<NamedFactory<Channel>> DEFAULT_CHANNEL_FACTORIES =
-            Collections.unmodifiableList(Arrays.<NamedFactory<Channel>>asList(ForwardedTcpipFactory.INSTANCE));
+            Collections.unmodifiableList(Collections.singletonList(ForwardedTcpipFactory.INSTANCE));
     public static final List<RequestHandler<ConnectionService>> DEFAULT_GLOBAL_REQUEST_HANDLERS =
-            Collections.unmodifiableList(Arrays.<RequestHandler<ConnectionService>>asList(
-                    OpenSshHostKeysHandler.INSTANCE));
+            Collections.unmodifiableList(Collections.singletonList(OpenSshHostKeysHandler.INSTANCE));
 
     public static final ServerKeyVerifier DEFAULT_SERVER_KEY_VERIFIER = AcceptAllServerKeyVerifier.INSTANCE;
     public static final HostConfigEntryResolver DEFAULT_HOST_CONFIG_ENTRY_RESOLVER = DefaultConfigFileHostEntryResolver.INSTANCE;
@@ -111,7 +103,7 @@ public class ClientBuilder extends BaseBuilder<SshClient, ClientBuilder> {
         super.fillWithDefaultValues();
 
         if (compressionFactories == null) {
-            compressionFactories = NamedFactory.Utils.setUpBuiltinFactories(false, DEFAULT_COMPRESSION_FACTORIES);
+            compressionFactories = NamedFactory.setUpBuiltinFactories(false, DEFAULT_COMPRESSION_FACTORIES);
         }
 
         if (keyExchangeFactories == null) {
@@ -172,7 +164,7 @@ public class ClientBuilder extends BaseBuilder<SshClient, ClientBuilder> {
      * @see org.apache.sshd.common.kex.BuiltinDHFactories#isSupported()
      */
     public static List<NamedFactory<KeyExchange>> setUpDefaultKeyExchanges(boolean ignoreUnsupported) {
-        return NamedFactory.Utils.setUpTransformedFactories(ignoreUnsupported, DEFAULT_KEX_PREFERENCE, DH2KEX);
+        return NamedFactory.setUpTransformedFactories(ignoreUnsupported, DEFAULT_KEX_PREFERENCE, DH2KEX);
     }
 
     public static ClientBuilder builder() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
index 2cdfca0..17f8bb4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
@@ -37,7 +37,6 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.GeneralSecurityException;
 import java.security.KeyPair;
-import java.security.PublicKey;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -50,7 +49,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.function.Supplier;
 import java.util.logging.ConsoleHandler;
 import java.util.logging.Formatter;
 import java.util.logging.Handler;
@@ -71,14 +69,12 @@ import org.apache.sshd.client.channel.ClientChannel;
 import org.apache.sshd.client.channel.ClientChannelEvent;
 import org.apache.sshd.client.config.hosts.HostConfigEntry;
 import org.apache.sshd.client.config.hosts.HostConfigEntryResolver;
-import org.apache.sshd.client.config.hosts.KnownHostEntry;
 import org.apache.sshd.client.config.keys.ClientIdentityLoader;
 import org.apache.sshd.client.config.keys.DefaultClientIdentitiesWatcher;
 import org.apache.sshd.client.future.ConnectFuture;
 import org.apache.sshd.client.future.DefaultConnectFuture;
 import org.apache.sshd.client.keyverifier.DefaultKnownHostsServerKeyVerifier;
 import org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier;
-import org.apache.sshd.client.keyverifier.ModifiedServerKeyAcceptor;
 import org.apache.sshd.client.keyverifier.ServerKeyVerifier;
 import org.apache.sshd.client.session.AbstractClientSession;
 import org.apache.sshd.client.session.ClientConnectionServiceFactory;
@@ -177,12 +173,7 @@ import org.apache.sshd.common.util.net.SshdSocketAddress;
  */
 public class SshClient extends AbstractFactoryManager implements ClientFactoryManager, ClientSessionCreator, Closeable {
 
-    public static final Factory<SshClient> DEFAULT_SSH_CLIENT_FACTORY = new Factory<SshClient>() {
-        @Override
-        public SshClient create() {
-            return new SshClient();
-        }
-    };
+    public static final Factory<SshClient> DEFAULT_SSH_CLIENT_FACTORY = SshClient::new;
 
     /**
      * Command line option used to indicate non-default target port
@@ -222,7 +213,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
     private final AuthenticationIdentitiesProvider identitiesProvider;
 
     public SshClient() {
-        identitiesProvider = AuthenticationIdentitiesProvider.Utils.wrap(identities);
+        identitiesProvider = AuthenticationIdentitiesProvider.wrap(identities);
     }
 
     public SessionFactory getSessionFactory() {
@@ -342,8 +333,8 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
             return null;
         }
 
-        int index = AuthenticationIdentitiesProvider.Utils.findIdentityIndex(
-                identities, AuthenticationIdentitiesProvider.Utils.PASSWORD_IDENTITY_COMPARATOR, password);
+        int index = AuthenticationIdentitiesProvider.findIdentityIndex(
+                identities, AuthenticationIdentitiesProvider.PASSWORD_IDENTITY_COMPARATOR, password);
         if (index >= 0) {
             return (String) identities.remove(index);
         } else {
@@ -370,8 +361,8 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
             return null;
         }
 
-        int index = AuthenticationIdentitiesProvider.Utils.findIdentityIndex(
-                identities, AuthenticationIdentitiesProvider.Utils.KEYPAIR_IDENTITY_COMPARATOR, kp);
+        int index = AuthenticationIdentitiesProvider.findIdentityIndex(
+                identities, AuthenticationIdentitiesProvider.KEYPAIR_IDENTITY_COMPARATOR, kp);
         if (index >= 0) {
             return (KeyPair) identities.remove(index);
         } else {
@@ -393,18 +384,8 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
         KeyPairProvider defaultIdentities = getKeyPairProvider();
         if (defaultIdentities == null) {
             setKeyPairProvider(new DefaultClientIdentitiesWatcher(
-                    new Supplier<ClientIdentityLoader>() {
-                        @Override
-                        public ClientIdentityLoader get() {
-                            return getClientIdentityLoader();
-                        }
-                    },
-                    new Supplier<FilePasswordProvider>() {
-                        @Override
-                        public FilePasswordProvider get() {
-                            return getFilePasswordProvider();
-                        }
-                    }));
+                    this::getClientIdentityLoader,
+                    this::getFilePasswordProvider));
         }
 
         // Register the additional agent forwarding channel if needed
@@ -466,26 +447,16 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
     @Override
     protected Closeable getInnerCloseable() {
         return builder()
-                .run(new Runnable() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public void run() {
-                        removeSessionTimeout(sessionFactory);
-                    }
-                })
+                .run(() -> removeSessionTimeout(sessionFactory))
                 .sequential(connector, ioServiceFactory)
-                .run(new Runnable() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public void run() {
-                        connector = null;
-                        ioServiceFactory = null;
-                        if (shutdownExecutor && (executor != null) && (!executor.isShutdown())) {
-                            try {
-                                executor.shutdownNow();
-                            } finally {
-                                executor = null;
-                            }
+                .run(() -> {
+                    connector = null;
+                    ioServiceFactory = null;
+                    if (shutdownExecutor && (executor != null) && (!executor.isShutdown())) {
+                        try {
+                            executor.shutdownNow();
+                        } finally {
+                            executor = null;
                         }
                     }
                 })
@@ -610,25 +581,21 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
     protected SshFutureListener<IoConnectFuture> createConnectCompletionListener(
             final ConnectFuture connectFuture, final String username, final SocketAddress address,
             final Collection<? extends KeyPair> identities, final boolean useDefaultIdentities) {
-        return new SshFutureListener<IoConnectFuture>() {
-            @Override
-            @SuppressWarnings("synthetic-access")
-            public void operationComplete(IoConnectFuture future) {
-                if (future.isCanceled()) {
-                    connectFuture.cancel();
-                    return;
-                }
+        return future -> {
+            if (future.isCanceled()) {
+                connectFuture.cancel();
+                return;
+            }
 
-                Throwable t = future.getException();
-                if (t != null) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("operationComplete({}@{}) failed ({}): {}",
-                                  username, address, t.getClass().getSimpleName(), t.getMessage());
-                    }
-                    connectFuture.setException(t);
-                } else {
-                    onConnectOperationComplete(future.getSession(), connectFuture, username, address, identities, useDefaultIdentities);
+            Throwable t = future.getException();
+            if (t != null) {
+                if (log.isDebugEnabled()) {
+                    log.debug("operationComplete({}@{}) failed ({}): {}",
+                              username, address, t.getClass().getSimpleName(), t.getMessage());
                 }
+                connectFuture.setException(t);
+            } else {
+                onConnectOperationComplete(future.getSession(), connectFuture, username, address, identities, useDefaultIdentities);
             }
         };
     }
@@ -1021,12 +988,9 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
     public static AbstractFileKeyPairProvider setupSessionIdentities(ClientFactoryManager client, Collection<File> identities,
             final BufferedReader stdin, final PrintStream stdout, final PrintStream stderr)
                 throws Throwable {
-        client.setFilePasswordProvider(new FilePasswordProvider() {
-            @Override
-            public String getPassword(String file) throws IOException {
-                stdout.print("Enter password for private key file=" + file + ": ");
-                return stdin.readLine();
-            }
+        client.setFilePasswordProvider(file -> {
+            stdout.print("Enter password for private key file=" + file + ": ");
+            return stdin.readLine();
         });
 
         if (GenericUtils.isEmpty(identities)) {
@@ -1109,24 +1073,20 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
             current = new DefaultKnownHostsServerKeyVerifier(current, false, Paths.get(filePath));
         }
 
-        ((KnownHostsServerKeyVerifier) current).setModifiedServerKeyAcceptor(new ModifiedServerKeyAcceptor() {
-            @Override
-            public boolean acceptModifiedServerKey(ClientSession clientSession, SocketAddress remoteAddress,
-                    KnownHostEntry entry, PublicKey expected, PublicKey actual) throws Exception {
-                stderr.append("Mismatched keys presented by ").append(Objects.toString(remoteAddress))
-                      .append(" for entry=").println(entry);
-                stderr.append('\t').append("Expected=").append(KeyUtils.getKeyType(expected))
-                      .append('-').println(KeyUtils.getFingerPrint(expected));
-                stderr.append('\t').append("Actual=").append(KeyUtils.getKeyType(actual))
-                      .append('-').println(KeyUtils.getFingerPrint(actual));
-                stderr.flush(); // just making sure
-
-                stdout.append("Accept key and update known hosts: y/[N]");
-                stdout.flush(); // just making sure
-
-                String ans = GenericUtils.trimToEmpty(stdin.readLine());
-                return (GenericUtils.length(ans) > 0) && (Character.toLowerCase(ans.charAt(0)) == 'y');
-            }
+        ((KnownHostsServerKeyVerifier) current).setModifiedServerKeyAcceptor((clientSession, remoteAddress, entry, expected, actual) -> {
+            stderr.append("Mismatched keys presented by ").append(Objects.toString(remoteAddress))
+                  .append(" for entry=").println(entry);
+            stderr.append('\t').append("Expected=").append(KeyUtils.getKeyType(expected))
+                  .append('-').println(KeyUtils.getFingerPrint(expected));
+            stderr.append('\t').append("Actual=").append(KeyUtils.getKeyType(actual))
+                  .append('-').println(KeyUtils.getFingerPrint(actual));
+            stderr.flush(); // just making sure
+
+            stdout.append("Accept key and update known hosts: y/[N]");
+            stdout.flush(); // just making sure
+
+            String ans = GenericUtils.trimToEmpty(stdin.readLine());
+            return (GenericUtils.length(ans) > 0) && (Character.toLowerCase(ans.charAt(0)) == 'y');
         });
 
         manager.setServerKeyVerifier(current);
@@ -1201,7 +1161,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
     public static List<NamedFactory<Compression>> setupCompressions(
             String argName, String argVal, List<NamedFactory<Compression>> current, PrintStream stderr) {
         if (GenericUtils.size(current) > 0) {
-            showError(stderr, argName + " option value re-specified: " + NamedResource.Utils.getNames(current));
+            showError(stderr, argName + " option value re-specified: " + NamedResource.getNames(current));
             return null;
         }
 
@@ -1229,7 +1189,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
 
     public static List<NamedFactory<Mac>> setupMacs(String argName, String argVal, List<NamedFactory<Mac>> current, PrintStream stderr) {
         if (GenericUtils.size(current) > 0) {
-            showError(stderr, argName + " option value re-specified: " + NamedResource.Utils.getNames(current));
+            showError(stderr, argName + " option value re-specified: " + NamedResource.getNames(current));
             return null;
         }
 
@@ -1258,7 +1218,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
     // returns null - e.g., re-specified or no supported cipher found
     public static List<NamedFactory<Cipher>> setupCiphers(String argName, String argVal, List<NamedFactory<Cipher>> current, PrintStream stderr) {
         if (GenericUtils.size(current) > 0) {
-            showError(stderr, argName + " option value re-specified: " + NamedResource.Utils.getNames(current));
+            showError(stderr, argName + " option value re-specified: " + NamedResource.getNames(current));
             return null;
         }
 
@@ -1437,12 +1397,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
                             ((ChannelShell) channel).setAgentForwarding(agentForward);
                             channel.setIn(new NoCloseInputStream(System.in));
                         } else {
-                            StringBuilder w = new StringBuilder(command.size() * Integer.SIZE);
-                            for (String cmd : command) {
-                                w.append(cmd).append(' ');
-                            }
-
-                            channel = session.createExecChannel(w.toString().trim());
+                            channel = session.createExecChannel(String.join(" ", command).trim());
                         }
 
                         try (OutputStream channelOut = new NoCloseOutputStream(System.out);
@@ -1463,7 +1418,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
                 session.close();
             }
         } finally {
-            if ((logStream != stdout) && (logStream != stderr)) {
+            if (logStream != null && logStream != stdout && logStream != stderr) {
                 logStream.close();
             }
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java b/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
index 7bf4ff6..bb7ff42 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
@@ -308,9 +308,7 @@ public class SshKeyScan extends AbstractSimplifiedLog
                     log(Level.FINER, "Authenticating with key type=" + kt + " to " + remoteLocation);
                 }
 
-                for (KeyPair kp : ids) {
-                    session.addPublicKeyIdentity(kp);
-                }
+                GenericUtils.forEach(ids, session::addPublicKeyIdentity);
 
                 try {
                     // shouldn't really succeed, but do it since key exchange occurs only on auth attempt
@@ -321,9 +319,7 @@ public class SshKeyScan extends AbstractSimplifiedLog
                         log(Level.FINER, "Failed to authenticate using key type=" + kt + " with " + remoteLocation);
                     }
                 } finally {
-                    for (KeyPair kp : ids) {
-                        session.removePublicKeyIdentity(kp);
-                    }
+                    GenericUtils.forEach(ids, session::removePublicKeyIdentity);
                 }
             } finally {
                 session.removeSessionListener(this);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java
index 7afd266..edba4e3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java
@@ -36,6 +36,33 @@ import org.apache.sshd.common.util.GenericUtils;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public interface AuthenticationIdentitiesProvider extends KeyIdentityProvider, PasswordIdentityProvider {
+
+    /**
+     * Compares 2 password identities - returns zero ONLY if <U>both</U> compared
+     * objects are {@link String}s and equal to each other
+     */
+    Comparator<Object> PASSWORD_IDENTITY_COMPARATOR = (o1, o2) -> {
+        if (!(o1 instanceof String) || !(o2 instanceof String)) {
+            return -1;
+        } else {
+            return ((String) o1).compareTo((String) o2);
+        }
+    };
+
+    /**
+     * Compares 2 {@link KeyPair} identities - returns zero ONLY if <U>both</U> compared
+     * objects are {@link KeyPair}s and equal to each other
+     */
+    Comparator<Object> KEYPAIR_IDENTITY_COMPARATOR = (o1, o2) -> {
+        if ((!(o1 instanceof KeyPair)) || (!(o2 instanceof KeyPair))) {
+            return -1;
+        } else if (KeyUtils.compareKeyPairs((KeyPair) o1, (KeyPair) o2)) {
+            return 0;
+        } else {
+            return 1;
+        }
+    };
+
     /**
      * @return All the currently available identities - passwords, keys, etc...
      */
@@ -46,97 +73,79 @@ public interface AuthenticationIdentitiesProvider extends KeyIdentityProvider, P
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
-        /**
-         * Compares 2 password identities - returns zero ONLY if <U>both</U> compared
-         * objects are {@link String}s and equal to each other
-         */
-        public static final Comparator<Object> PASSWORD_IDENTITY_COMPARATOR = new Comparator<Object>() {
-            @Override
-            public int compare(Object o1, Object o2) {
-                if (!(o1 instanceof String) || !(o2 instanceof String)) {
-                    return -1;
-                } else {
-                    return ((String) o1).compareTo((String) o2);
-                }
-            }
-        };
 
-        /**
-         * Compares 2 {@link KeyPair} identities - returns zero ONLY if <U>both</U> compared
-         * objects are {@link KeyPair}s and equal to each other
-         */
-        public static final Comparator<Object> KEYPAIR_IDENTITY_COMPARATOR = new Comparator<Object>() {
-            @Override
-            public int compare(Object o1, Object o2) {
-                if ((!(o1 instanceof KeyPair)) || (!(o2 instanceof KeyPair))) {
-                    return -1;
-                } else if (KeyUtils.compareKeyPairs((KeyPair) o1, (KeyPair) o2)) {
-                    return 0;
-                } else {
-                    return 1;
-                }
-            }
-        };
+        public static final Comparator<Object> PASSWORD_IDENTITY_COMPARATOR = AuthenticationIdentitiesProvider.PASSWORD_IDENTITY_COMPARATOR;
+
+        public static final Comparator<Object> KEYPAIR_IDENTITY_COMPARATOR = AuthenticationIdentitiesProvider.KEYPAIR_IDENTITY_COMPARATOR;
 
         private Utils() {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
         public static int findIdentityIndex(List<?> identities, Comparator<? super Object> comp, Object target) {
-            for (int index = 0; index < identities.size(); index++) {
-                Object value = identities.get(index);
-                if (comp.compare(value, target) == 0) {
-                    return index;
-                }
-            }
-
-            return -1;
+            return AuthenticationIdentitiesProvider.findIdentityIndex(identities, comp, target);
         }
 
-        /**
-         * @param identities The {@link Iterable} identities - OK if {@code null}/empty
-         * @return An {@link AuthenticationIdentitiesProvider} wrapping the identities
-         */
         public static AuthenticationIdentitiesProvider wrap(final Iterable<?> identities) {
-            return new AuthenticationIdentitiesProvider() {
-                @Override
-                public Iterable<KeyPair> loadKeys() {
-                    return selectIdentities(KeyPair.class);
-                }
+            return AuthenticationIdentitiesProvider.wrap(identities);
+        }
+    }
 
-                @Override
-                public Iterable<String> loadPasswords() {
-                    return selectIdentities(String.class);
-                }
+    static int findIdentityIndex(List<?> identities, Comparator<? super Object> comp, Object target) {
+        for (int index = 0; index < identities.size(); index++) {
+            Object value = identities.get(index);
+            if (comp.compare(value, target) == 0) {
+                return index;
+            }
+        }
 
-                @Override
-                public Iterable<?> loadIdentities() {
-                    return selectIdentities(Object.class);
-                }
+        return -1;
+    }
+
+    /**
+     * @param identities The {@link Iterable} identities - OK if {@code null}/empty
+     * @return An {@link AuthenticationIdentitiesProvider} wrapping the identities
+     */
+    static AuthenticationIdentitiesProvider wrap(final Iterable<?> identities) {
+        return new AuthenticationIdentitiesProvider() {
+            @Override
+            public Iterable<KeyPair> loadKeys() {
+                return selectIdentities(KeyPair.class);
+            }
 
-                // NOTE: returns a NEW Collection on every call so that the original
-                //      identities remain unchanged
-                private <T> Collection<T> selectIdentities(Class<T> type) {
-                    Collection<T> matches = null;
-                    for (Iterator<?> iter = GenericUtils.iteratorOf(identities); iter.hasNext();) {
-                        Object o = iter.next();
-                        Class<?> t = o.getClass();
-                        if (!type.isAssignableFrom(t)) {
-                            continue;
-                        }
-
-                        if (matches == null) {
-                            matches = new LinkedList<>();
-                        }
-
-                        matches.add(type.cast(o));
+            @Override
+            public Iterable<String> loadPasswords() {
+                return selectIdentities(String.class);
+            }
+
+            @Override
+            public Iterable<?> loadIdentities() {
+                return selectIdentities(Object.class);
+            }
+
+            // NOTE: returns a NEW Collection on every call so that the original
+            //      identities remain unchanged
+            private <T> Collection<T> selectIdentities(Class<T> type) {
+                Collection<T> matches = null;
+                for (Iterator<?> iter = GenericUtils.iteratorOf(identities); iter.hasNext();) {
+                    Object o = iter.next();
+                    Class<?> t = o.getClass();
+                    if (!type.isAssignableFrom(t)) {
+                        continue;
                     }
 
-                    return (matches == null) ? Collections.<T>emptyList() : matches;
+                    if (matches == null) {
+                        matches = new LinkedList<>();
+                    }
+
+                    matches.add(type.cast(o));
                 }
-            };
-        }
+
+                return (matches == null) ? Collections.<T>emptyList() : matches;
+            }
+        };
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java
index ba40caa..670efcc 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java
@@ -72,7 +72,7 @@ public enum BuiltinUserAuthFactories implements NamedFactory<UserAuthFactory> {
      * @return The matching factory instance - {@code null} if no match found
      */
     public static UserAuthFactory fromFactoryName(String name) {
-        Factory<UserAuthFactory> factory = NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
         if (factory == null) {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
index 5362d8f..0e37e57 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
@@ -21,7 +21,6 @@ package org.apache.sshd.client.auth.hostbased;
 
 import java.security.KeyPair;
 import java.security.cert.X509Certificate;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
@@ -43,6 +42,7 @@ public interface HostKeyIdentityProvider {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
         private Utils() {
@@ -50,44 +50,30 @@ public interface HostKeyIdentityProvider {
         }
 
         public static Iterator<Pair<KeyPair, List<X509Certificate>>> iteratorOf(HostKeyIdentityProvider provider) {
-            return GenericUtils.iteratorOf((provider == null) ? null : provider.loadHostKeys());
+            return HostKeyIdentityProvider.iteratorOf(provider);
         }
 
         public static HostKeyIdentityProvider wrap(KeyPair ... pairs) {
-            return wrap(GenericUtils.isEmpty(pairs) ? Collections.emptyList() : Arrays.asList(pairs));
+            return HostKeyIdentityProvider.wrap(pairs);
         }
 
         public static HostKeyIdentityProvider wrap(final Iterable<? extends KeyPair> pairs) {
-            return new HostKeyIdentityProvider() {
-                @Override
-                public Iterable<Pair<KeyPair, List<X509Certificate>>> loadHostKeys() {
-                    return new Iterable<Pair<KeyPair, List<X509Certificate>>>() {
-                        @Override
-                        public Iterator<Pair<KeyPair, List<X509Certificate>>> iterator() {
-                            final Iterator<? extends KeyPair> iter = GenericUtils.iteratorOf(pairs);
-                            return new Iterator<Pair<KeyPair, List<X509Certificate>>>() {
-
-                                @Override
-                                public boolean hasNext() {
-                                    return iter.hasNext();
-                                }
+            return HostKeyIdentityProvider.wrap(pairs);
+        }
+    }
 
-                                @Override
-                                public Pair<KeyPair, List<X509Certificate>> next() {
-                                    KeyPair kp = iter.next();
-                                    return new Pair<>(kp, Collections.emptyList());
-                                }
+    static Iterator<Pair<KeyPair, List<X509Certificate>>> iteratorOf(HostKeyIdentityProvider provider) {
+        return GenericUtils.iteratorOf((provider == null) ? null : provider.loadHostKeys());
+    }
 
-                                @Override
-                                public void remove() {
-                                    throw new UnsupportedOperationException("No removal allowed");
-                                }
-                            };
-                        }
-                    };
-                }
+    static HostKeyIdentityProvider wrap(KeyPair ... pairs) {
+        return wrap(GenericUtils.asList(pairs));
+    }
 
-            };
-        }
+    static HostKeyIdentityProvider wrap(final Iterable<? extends KeyPair> pairs) {
+        return () -> () -> {
+            final Iterator<? extends KeyPair> iter = GenericUtils.iteratorOf(pairs);
+            return GenericUtils.wrapIterator(iter, kp -> new Pair<>(kp, Collections.<X509Certificate>emptyList()));
+        };
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/UserAuthHostBased.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/UserAuthHostBased.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/UserAuthHostBased.java
index 3d8c832..398cc4c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/UserAuthHostBased.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/UserAuthHostBased.java
@@ -62,7 +62,7 @@ public class UserAuthHostBased extends AbstractUserAuth implements SignatureFact
     @Override
     public void init(ClientSession session, String service) throws Exception {
         super.init(session, service);
-        keys = HostKeyIdentityProvider.Utils.iteratorOf(clientHostKeys);  // in case multiple calls to the method
+        keys = HostKeyIdentityProvider.iteratorOf(clientHostKeys);  // in case multiple calls to the method
     }
 
     @Override
@@ -117,7 +117,7 @@ public class UserAuthHostBased extends AbstractUserAuth implements SignatureFact
                         "No signature factories for session=%s",
                         session);
         Signature verifier = ValidateUtils.checkNotNull(
-                NamedFactory.Utils.create(factories, keyType),
+                NamedFactory.create(factories, keyType),
                 "No signer could be located for key type=%s",
                 keyType);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java
index f1fc526..0add7ed 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java
@@ -88,7 +88,7 @@ public class UserAuthKeyboardInteractive extends AbstractUserAuth {
     @Override
     public void init(ClientSession session, String service) throws Exception {
         super.init(session, service);
-        passwords = PasswordIdentityProvider.Utils.iteratorOf(session);
+        passwords = PasswordIdentityProvider.iteratorOf(session);
         maxTrials = PropertyResolverUtils.getIntProperty(session, ClientAuthenticationManager.PASSWORD_PROMPTS, ClientAuthenticationManager.DEFAULT_PASSWORD_PROMPTS);
         ValidateUtils.checkTrue(maxTrials > 0, "Non-positive max. trials: %d", maxTrials);
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
index fe37f39..268779c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
@@ -19,12 +19,9 @@
 
 package org.apache.sshd.client.auth.password;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.function.Supplier;
 
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.util.GenericUtils;
@@ -34,6 +31,7 @@ import org.apache.sshd.common.util.Transformer;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public interface PasswordIdentityProvider {
+
     /**
      * An &quot;empty&quot implementation of {@link PasswordIdentityProvider} that returns
      * and empty group of passwords
@@ -51,6 +49,13 @@ public interface PasswordIdentityProvider {
     };
 
     /**
+     * Invokes {@link PasswordIdentityProvider#loadPasswords()} and returns the result.
+     * Ignores {@code null} providers (i.e., returns an empty iterable instance)
+     */
+    Transformer<PasswordIdentityProvider, Iterable<String>> LOADER = p ->
+            (p == null) ? Collections.emptyList() : p.loadPasswords();
+
+    /**
      * @return The currently available passwords - ignored if {@code null}
      */
     Iterable<String> loadPasswords();
@@ -60,166 +65,168 @@ public interface PasswordIdentityProvider {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
-        /**
-         * Invokes {@link PasswordIdentityProvider#loadPasswords()} and returns the result.
-         * Ignores {@code null} providers (i.e., returns an empty iterable instance)
-         */
+
         public static final Transformer<PasswordIdentityProvider, Iterable<String>> LOADER =
-            new Transformer<PasswordIdentityProvider, Iterable<String>>() {
-                @Override
-                public Iterable<String> transform(PasswordIdentityProvider p) {
-                    return (p == null) ? Collections.emptyList() : p.loadPasswords();
-                }
-            };
+                PasswordIdentityProvider.LOADER;
 
         private Utils() {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * Creates a &quot;unified&quot; {@link Iterator} of passwords out of the registered
-         * passwords and the extra available ones as a single iterator of passwords
-         *
-         * @param session The {@link ClientSession} - ignored if {@code null} (i.e., empty
-         * iterator returned)
-         * @return The wrapping iterator
-         * @see ClientSession#getRegisteredIdentities()
-         * @see ClientSession#getPasswordIdentityProvider()
-         */
         public static Iterator<String> iteratorOf(ClientSession session) {
-            return (session == null) ? Collections.emptyIterator() : iteratorOf(session.getRegisteredIdentities(), session.getPasswordIdentityProvider());
+            return PasswordIdentityProvider.iteratorOf(session);
         }
 
-        /**
-         * Creates a &quot;unified&quot; {@link Iterator} of passwords out of 2 possible
-         * {@link PasswordIdentityProvider}
-         *
-         * @param identities The registered passwords
-         * @param passwords Extra available passwords
-         * @return The wrapping iterator
-         * @see #resolvePasswordIdentityProvider(PasswordIdentityProvider, PasswordIdentityProvider)
-         */
         public static Iterator<String> iteratorOf(PasswordIdentityProvider identities, PasswordIdentityProvider passwords) {
-            return iteratorOf(resolvePasswordIdentityProvider(identities, passwords));
+            return PasswordIdentityProvider.iteratorOf(identities, passwords);
         }
 
-        /**
-         * Resolves a non-{@code null} iterator of the available passwords
-         *
-         * @param provider The {@link PasswordIdentityProvider} - ignored if {@code null} (i.e.,
-         * return an empty iterator)
-         * @return A non-{@code null} iterator - which may be empty if no provider or no passwords
-         */
         public static Iterator<String> iteratorOf(PasswordIdentityProvider provider) {
-            return GenericUtils.iteratorOf((provider == null) ? null : provider.loadPasswords());
+            return PasswordIdentityProvider.iteratorOf(provider);
         }
 
-        /**
-         * <P>Creates a &quot;unified&quot; {@link PasswordIdentityProvider} out of 2 possible ones
-         * as follows:</P></BR>
-         * <UL>
-         *      <LI>If both are {@code null} then return {@code null}.</LI>
-         *      <LI>If either one is {@code null} then use the non-{@code null} one.</LI>
-         *      <LI>If both are the same instance then use it.</U>
-         *      <LI>Otherwise, returns a wrapper that groups both providers.</LI>
-         * </UL>
-         * @param identities The registered passwords
-         * @param passwords The extra available passwords
-         * @return The resolved provider
-         * @see #multiProvider(PasswordIdentityProvider...)
-         */
         public static PasswordIdentityProvider resolvePasswordIdentityProvider(PasswordIdentityProvider identities, PasswordIdentityProvider passwords) {
-            if ((passwords == null) || (identities == passwords)) {
-                return identities;
-            } else if (identities == null) {
-                return passwords;
-            } else {
-                return multiProvider(identities, passwords);
-            }
+            return PasswordIdentityProvider.resolvePasswordIdentityProvider(identities, passwords);
         }
 
-        /**
-         * Wraps a group of {@link PasswordIdentityProvider} into a single one
-         *
-         * @param providers The providers - ignored if {@code null}/empty (i.e., returns
-         * {@link #EMPTY_PASSWORDS_PROVIDER}
-         * @return The wrapping provider
-         * @see #multiProvider(Collection)
-         */
         public static PasswordIdentityProvider multiProvider(PasswordIdentityProvider ... providers) {
-            return GenericUtils.isEmpty(providers) ? EMPTY_PASSWORDS_PROVIDER : multiProvider(Arrays.asList(providers));
+            return PasswordIdentityProvider.multiProvider(providers);
         }
 
-        /**
-         * Wraps a group of {@link PasswordIdentityProvider} into a single one
-         *
-         * @param providers The providers - ignored if {@code null}/empty (i.e., returns
-         * {@link #EMPTY_PASSWORDS_PROVIDER}
-         * @return The wrapping provider
-         */
         public static PasswordIdentityProvider multiProvider(Collection<? extends PasswordIdentityProvider> providers) {
-            return GenericUtils.isEmpty(providers) ? EMPTY_PASSWORDS_PROVIDER : wrap(iterableOf(providers));
+            return PasswordIdentityProvider.multiProvider(providers);
         }
 
-        /**
-         * Wraps a group of {@link PasswordIdentityProvider} into an {@link Iterable} of their combined passwords
-         *
-         * @param providers The providers - ignored if {@code null}/empty (i.e., returns an empty iterable instance)
-         * @return The wrapping iterable
-         */
         public static Iterable<String> iterableOf(Collection<? extends PasswordIdentityProvider> providers) {
-            if (GenericUtils.isEmpty(providers)) {
-                return Collections.emptyList();
-            }
-
-            Collection<Supplier<Iterable<String>>> suppliers = new ArrayList<>(providers.size());
-            for (final PasswordIdentityProvider p : providers) {
-                if (p == null) {
-                    continue;
-                }
-
-                suppliers.add(new Supplier<Iterable<String>>() {
-                    @Override
-                    public Iterable<String> get() {
-                        return p.loadPasswords();
-                    }
-                });
-            }
-
-            if (GenericUtils.isEmpty(suppliers)) {
-                return Collections.emptyList();
-            }
-
-            return GenericUtils.multiIterableSuppliers(suppliers);
+            return PasswordIdentityProvider.iterableOf(providers);
         }
 
-        /**
-         * Wraps a group of passwords into a {@link PasswordIdentityProvider}
-         *
-         * @param passwords The passwords - ignored if {@code null}/empty
-         * (i.e., returns {@link #EMPTY_PASSWORDS_PROVIDER})
-         * @return The provider wrapper
-         */
         public static PasswordIdentityProvider wrap(String ... passwords) {
-            return GenericUtils.isEmpty(passwords) ? EMPTY_PASSWORDS_PROVIDER : wrap(Arrays.asList(passwords));
+            return PasswordIdentityProvider.wrap(passwords);
         }
 
-        /**
-         * Wraps a group of passwords into a {@link PasswordIdentityProvider}
-         *
-         * @param passwords The passwords {@link Iterable} - ignored if {@code null}
-         * (i.e., returns {@link #EMPTY_PASSWORDS_PROVIDER})
-         * @return The provider wrapper
-         */
         public static PasswordIdentityProvider wrap(final Iterable<String> passwords) {
-            return (passwords == null) ? EMPTY_PASSWORDS_PROVIDER : new PasswordIdentityProvider() {
-                @Override
-                public Iterable<String> loadPasswords() {
-                    return passwords;
-                }
-            };
+            return PasswordIdentityProvider.wrap(passwords);
+        }
+    }
+
+    /**
+     * Creates a &quot;unified&quot; {@link Iterator} of passwords out of the registered
+     * passwords and the extra available ones as a single iterator of passwords
+     *
+     * @param session The {@link ClientSession} - ignored if {@code null} (i.e., empty
+     * iterator returned)
+     * @return The wrapping iterator
+     * @see ClientSession#getRegisteredIdentities()
+     * @see ClientSession#getPasswordIdentityProvider()
+     */
+    static Iterator<String> iteratorOf(ClientSession session) {
+        return (session == null) ? Collections.<String>emptyIterator() : iteratorOf(session.getRegisteredIdentities(), session.getPasswordIdentityProvider());
+    }
+
+    /**
+     * Creates a &quot;unified&quot; {@link Iterator} of passwords out of 2 possible
+     * {@link PasswordIdentityProvider}
+     *
+     * @param identities The registered passwords
+     * @param passwords Extra available passwords
+     * @return The wrapping iterator
+     * @see #resolvePasswordIdentityProvider(PasswordIdentityProvider, PasswordIdentityProvider)
+     */
+    static Iterator<String> iteratorOf(PasswordIdentityProvider identities, PasswordIdentityProvider passwords) {
+        return iteratorOf(resolvePasswordIdentityProvider(identities, passwords));
+    }
+
+    /**
+     * Resolves a non-{@code null} iterator of the available passwords
+     *
+     * @param provider The {@link PasswordIdentityProvider} - ignored if {@code null} (i.e.,
+     * return an empty iterator)
+     * @return A non-{@code null} iterator - which may be empty if no provider or no passwords
+     */
+    static Iterator<String> iteratorOf(PasswordIdentityProvider provider) {
+        return GenericUtils.iteratorOf((provider == null) ? null : provider.loadPasswords());
+    }
+
+    /**
+     * <P>Creates a &quot;unified&quot; {@link PasswordIdentityProvider} out of 2 possible ones
+     * as follows:</P></BR>
+     * <UL>
+     *      <LI>If both are {@code null} then return {@code null}.</LI>
+     *      <LI>If either one is {@code null} then use the non-{@code null} one.</LI>
+     *      <LI>If both are the same instance then use it.</U>
+     *      <LI>Otherwise, returns a wrapper that groups both providers.</LI>
+     * </UL>
+     * @param identities The registered passwords
+     * @param passwords The extra available passwords
+     * @return The resolved provider
+     * @see #multiProvider(PasswordIdentityProvider...)
+     */
+    static PasswordIdentityProvider resolvePasswordIdentityProvider(PasswordIdentityProvider identities, PasswordIdentityProvider passwords) {
+        if ((passwords == null) || (identities == passwords)) {
+            return identities;
+        } else if (identities == null) {
+            return passwords;
+        } else {
+            return multiProvider(identities, passwords);
         }
     }
+
+    /**
+     * Wraps a group of {@link PasswordIdentityProvider} into a single one
+     *
+     * @param providers The providers - ignored if {@code null}/empty (i.e., returns
+     * {@link #EMPTY_PASSWORDS_PROVIDER}
+     * @return The wrapping provider
+     * @see #multiProvider(Collection)
+     */
+    static PasswordIdentityProvider multiProvider(PasswordIdentityProvider ... providers) {
+        return multiProvider(GenericUtils.asList(providers));
+    }
+
+    /**
+     * Wraps a group of {@link PasswordIdentityProvider} into a single one
+     *
+     * @param providers The providers - ignored if {@code null}/empty (i.e., returns
+     * {@link #EMPTY_PASSWORDS_PROVIDER}
+     * @return The wrapping provider
+     */
+    static PasswordIdentityProvider multiProvider(Collection<? extends PasswordIdentityProvider> providers) {
+        return GenericUtils.isEmpty(providers) ? EMPTY_PASSWORDS_PROVIDER : wrap(iterableOf(providers));
+    }
+
+    /**
+     * Wraps a group of {@link PasswordIdentityProvider} into an {@link Iterable} of their combined passwords
+     *
+     * @param providers The providers - ignored if {@code null}/empty (i.e., returns an empty iterable instance)
+     * @return The wrapping iterable
+     */
+    static Iterable<String> iterableOf(Collection<? extends PasswordIdentityProvider> providers) {
+        return GenericUtils.multiIterableSuppliers(GenericUtils.wrapIterable(providers, p -> p::loadPasswords));
+    }
+
+    /**
+     * Wraps a group of passwords into a {@link PasswordIdentityProvider}
+     *
+     * @param passwords The passwords - ignored if {@code null}/empty
+     * (i.e., returns {@link #EMPTY_PASSWORDS_PROVIDER})
+     * @return The provider wrapper
+     */
+    static PasswordIdentityProvider wrap(String ... passwords) {
+        return wrap(GenericUtils.asList(passwords));
+    }
+
+    /**
+     * Wraps a group of passwords into a {@link PasswordIdentityProvider}
+     *
+     * @param passwords The passwords {@link Iterable} - ignored if {@code null}
+     * (i.e., returns {@link #EMPTY_PASSWORDS_PROVIDER})
+     * @return The provider wrapper
+     */
+    static PasswordIdentityProvider wrap(final Iterable<String> passwords) {
+        return (passwords == null) ? EMPTY_PASSWORDS_PROVIDER : () -> passwords;
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/auth/password/UserAuthPassword.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/UserAuthPassword.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/UserAuthPassword.java
index 37f3ba5..ad19637 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/UserAuthPassword.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/UserAuthPassword.java
@@ -48,7 +48,7 @@ public class UserAuthPassword extends AbstractUserAuth {
     @Override
     public void init(ClientSession session, String service) throws Exception {
         super.init(session, service);
-        passwords = PasswordIdentityProvider.Utils.iteratorOf(session);
+        passwords = PasswordIdentityProvider.iteratorOf(session);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/KeyPairIdentity.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/KeyPairIdentity.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/KeyPairIdentity.java
index 02400cd..2b5531c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/KeyPairIdentity.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/KeyPairIdentity.java
@@ -54,7 +54,7 @@ public class KeyPairIdentity implements PublicKeyIdentity {
     public byte[] sign(byte[] data) throws Exception {
         String keyType = KeyUtils.getKeyType(getPublicKey());
         Signature verifier = ValidateUtils.checkNotNull(
-                NamedFactory.Utils.create(signatureFactories, keyType),
+                NamedFactory.create(signatureFactories, keyType),
                 "No signer could be located for key type=%s",
                 keyType);
         verifier.initSigner(pair.getPrivate());
@@ -67,7 +67,7 @@ public class KeyPairIdentity implements PublicKeyIdentity {
         PublicKey pubKey = getPublicKey();
         return getClass().getSimpleName()
              + " type=" + KeyUtils.getKeyType(pubKey)
-             + ", factories=" + NamedResource.Utils.getNames(signatureFactories)
+             + ", factories=" + NamedResource.getNames(signatureFactories)
              + ", fingerprint=" + KeyUtils.getFingerPrint(pubKey);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKeyIterator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKeyIterator.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKeyIterator.java
index b8d934b..a75e13a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKeyIterator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKeyIterator.java
@@ -50,7 +50,7 @@ public class UserAuthPublicKeyIterator extends AbstractKeyPairIterator<PublicKey
         super(session);
 
         Collection<Iterator<? extends PublicKeyIdentity>> identities = new LinkedList<>();
-        identities.add(new SessionKeyPairIterator(session, signatureFactories, KeyIdentityProvider.Utils.iteratorOf(session)));
+        identities.add(new SessionKeyPairIterator(session, signatureFactories, KeyIdentityProvider.iteratorOf(session)));
 
         FactoryManager manager = ValidateUtils.checkNotNull(session.getFactoryManager(), "No session factory manager");
         SshAgentFactory factory = manager.getAgentFactory();


[03/16] mina-sshd git commit: [SSHD-698] Code cleanup

Posted by gn...@apache.org.
[SSHD-698] Code cleanup


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/57f6a6b0
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/57f6a6b0
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/57f6a6b0

Branch: refs/heads/master
Commit: 57f6a6b09f9f387d92014bfe91e5391762931b41
Parents: 13989b4
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Sep 15 11:21:25 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Sep 15 21:06:09 2016 +0200

----------------------------------------------------------------------
 ...impleAccessControlSftpEventListenerTest.java |  4 +--
 .../sshd/agent/local/AgentServerProxy.java      |  2 +-
 .../org/apache/sshd/agent/unix/AgentClient.java |  2 +-
 .../org/apache/sshd/agent/unix/AgentServer.java |  2 +-
 .../sshd/agent/unix/AgentServerProxy.java       |  2 +-
 .../sshd/agent/unix/ChannelAgentForwarding.java |  2 +-
 .../client/ClientAuthenticationManager.java     |  2 +-
 .../java/org/apache/sshd/client/SshClient.java  | 10 +++----
 .../java/org/apache/sshd/client/SshKeyScan.java |  4 +--
 .../client/auth/BuiltinUserAuthFactories.java   |  4 +--
 .../auth/hostbased/HostKeyIdentityProvider.java |  4 +--
 .../keyboard/UserAuthKeyboardInteractive.java   |  5 +---
 .../auth/password/PasswordIdentityProvider.java |  4 +--
 .../client/channel/AbstractClientChannel.java   |  2 +-
 .../channel/PtyCapableChannelSession.java       |  2 +-
 .../client/config/hosts/HostConfigEntry.java    |  8 ++---
 .../client/config/hosts/HostPatternsHolder.java |  7 ++---
 .../client/future/DefaultConnectFuture.java     |  2 +-
 .../KnownHostsServerKeyVerifier.java            |  4 +--
 .../sshd/client/scp/DefaultScpClient.java       |  4 +--
 .../sshd/client/session/ClientSession.java      |  2 +-
 .../sshd/client/subsystem/sftp/SftpClient.java  |  4 +--
 .../client/subsystem/sftp/SftpFileChannel.java  | 12 ++++----
 .../subsystem/sftp/SftpFileSystemProvider.java  |  4 +--
 .../helpers/AbstractSftpClientExtension.java    |  4 +--
 .../apache/sshd/common/SyspropsMapWrapper.java  |  2 +-
 .../sshd/common/channel/AbstractChannel.java    |  4 +--
 .../common/channel/ChannelAsyncInputStream.java |  2 +-
 .../apache/sshd/common/channel/SttySupport.java |  8 ++---
 .../org/apache/sshd/common/channel/Window.java  |  4 +--
 .../sshd/common/cipher/BuiltinCiphers.java      |  4 +--
 .../common/compression/BuiltinCompressions.java |  4 +--
 .../sshd/common/config/SshConfigFileReader.java |  4 +--
 .../sshd/common/config/TimeValueConfig.java     |  2 +-
 .../sshd/common/file/util/BaseFileSystem.java   |  2 +-
 .../apache/sshd/common/file/util/BasePath.java  |  2 +-
 .../virtualfs/VirtualFileSystemFactory.java     |  2 +-
 .../common/forward/DefaultTcpipForwarder.java   |  2 +-
 .../forward/DefaultTcpipForwarderFactory.java   |  2 +-
 .../common/helpers/AbstractFactoryManager.java  |  6 ++--
 .../common/kex/AbstractKexFactoryManager.java   | 10 +++----
 .../sshd/common/kex/BuiltinDHFactories.java     |  4 +--
 .../sshd/common/kex/KexFactoryManager.java      |  6 ++--
 ...actClassLoadableResourceKeyPairProvider.java |  2 +-
 .../AbstractFileKeyPairProvider.java            |  4 +--
 .../common/keyprovider/KeyIdentityProvider.java |  4 +--
 .../keyprovider/MappedKeyPairProvider.java      |  2 +-
 .../org/apache/sshd/common/mac/BuiltinMacs.java |  4 +--
 .../AbstractConnectionServiceFactory.java       |  2 +-
 .../org/apache/sshd/common/session/Session.java |  2 +-
 .../helpers/AbstractConnectionService.java      |  2 +-
 .../common/session/helpers/AbstractSession.java |  8 ++---
 .../common/signature/BuiltinSignatures.java     |  4 +--
 .../signature/SignatureFactoriesManager.java    |  2 +-
 .../sftp/extensions/AclSupportedParser.java     |  2 +-
 .../sftp/extensions/VersionsParser.java         |  2 +-
 .../sshd/common/util/EventListenerUtils.java    |  2 +-
 .../apache/sshd/common/util/GenericUtils.java   | 12 ++++----
 .../apache/sshd/common/util/SelectorUtils.java  | 14 ++-------
 .../keys/AbstractBufferPublicKeyParser.java     |  2 +-
 .../common/util/closeable/FuturesCloseable.java |  2 +-
 .../util/closeable/ParallelCloseable.java       |  2 +-
 .../util/closeable/SequentialCloseable.java     |  2 +-
 .../common/util/io/ModifiableFileWatcher.java   |  5 +---
 .../sshd/common/util/net/SshdSocketAddress.java |  5 +---
 .../server/ServerAuthenticationManager.java     |  2 +-
 .../java/org/apache/sshd/server/SshServer.java  |  2 +-
 .../apache/sshd/server/StandardEnvironment.java |  2 +-
 .../server/auth/BuiltinUserAuthFactories.java   |  4 +--
 .../auth/hostbased/UserAuthHostBased.java       |  2 +-
 .../keyboard/UserAuthKeyboardInteractive.java   |  2 +-
 .../pubkey/KeySetPublickeyAuthenticator.java    |  2 +-
 .../server/channel/AbstractServerChannel.java   |  2 +-
 .../sshd/server/forward/TcpipServerChannel.java |  2 +-
 .../sshd/server/scp/ScpCommandFactory.java      |  4 +--
 .../sshd/server/shell/InvertedShellWrapper.java |  2 +-
 .../apache/sshd/server/shell/ProcessShell.java  |  2 +-
 .../sshd/server/shell/ProcessShellFactory.java  |  6 ++--
 .../sftp/AbstractSftpEventListenerManager.java  |  2 +-
 .../server/subsystem/sftp/SftpSubsystem.java    | 12 ++++----
 .../src/test/java/org/apache/sshd/LoadTest.java |  4 +--
 .../java/org/apache/sshd/client/ClientTest.java | 31 +++++++++-----------
 .../hosts/ConfigFileHostEntryResolverTest.java  |  2 +-
 .../client/simple/SimpleSftpClientTest.java     |  4 +--
 .../sftp/AbstractSftpClientTestSupport.java     |  4 +--
 .../subsystem/sftp/SftpFileSystemTest.java      | 12 ++++----
 .../client/subsystem/sftp/SftpVersionsTest.java |  4 +--
 .../helpers/CopyDataExtensionImplTest.java      |  2 +-
 .../SpaceAvailableExtensionImplTest.java        |  2 +-
 .../openssh/helpers/OpenSSHExtensionsTest.java  |  3 +-
 .../sshd/common/auth/AuthenticationTest.java    | 17 +++++------
 .../channel/ChannelPipedInputStreamTest.java    |  2 +-
 .../apache/sshd/common/channel/WindowTest.java  |  3 +-
 .../sshd/common/cipher/BuiltinCiphersTest.java  |  2 +-
 .../apache/sshd/common/cipher/CipherTest.java   |  2 +-
 .../compression/BuiltinCompressionsTest.java    |  2 +-
 .../common/compression/CompressionTest.java     |  3 +-
 .../file/root/RootedFileSystemProviderTest.java |  6 ++--
 .../sshd/common/file/util/BasePathTest.java     |  2 +-
 .../io/DefaultIoServiceFactoryFactoryTest.java  |  4 +--
 .../sshd/common/kex/BuiltinDHFactoriesTest.java |  2 +-
 .../apache/sshd/common/mac/BuiltinMacsTest.java |  2 +-
 .../org/apache/sshd/common/mac/MacTest.java     |  3 +-
 .../apache/sshd/common/mac/MacVectorsTest.java  |  2 +-
 .../common/signature/BuiltinSignaturesTest.java |  2 +-
 .../common/util/EventListenerUtilsTest.java     |  2 +-
 .../apache/sshd/deprecated/UserAuthAgent.java   |  2 +-
 .../sshd/deprecated/UserAuthPublicKey.java      |  2 +-
 .../sshd/server/ServerSessionListenerTest.java  |  3 +-
 .../sshd/server/auth/WelcomeBannerTest.java     |  2 +-
 .../sshd/server/channel/ChannelSessionTest.java |  4 +--
 .../server/shell/TtyFilterOutputStreamTest.java |  6 ++--
 .../server/subsystem/sftp/SshFsMounter.java     |  3 +-
 .../apache/sshd/util/test/BaseTestSupport.java  |  4 +--
 .../org/apache/sshd/util/test/EchoShell.java    |  5 +---
 .../sshd/git/pack/GitPackCommandTest.java       |  4 +--
 .../apache/sshd/git/pgm/GitPgmCommandTest.java  |  4 +--
 .../auth/pubkey/LdapPublickeyAuthenticator.java |  2 +-
 118 files changed, 210 insertions(+), 261 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java
----------------------------------------------------------------------
diff --git a/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java b/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java
index 1a75871..6f90d3d 100644
--- a/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java
+++ b/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java
@@ -30,12 +30,10 @@ import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.client.subsystem.sftp.SftpClient;
 import org.apache.sshd.client.subsystem.sftp.SftpClient.CloseableHandle;
 import org.apache.sshd.client.subsystem.sftp.SftpClient.OpenMode;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.file.FileSystemFactory;
 import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
 import org.apache.sshd.common.subsystem.sftp.SftpException;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.scp.ScpCommandFactory;
 import org.apache.sshd.util.test.BaseTestSupport;
@@ -68,7 +66,7 @@ public class SimpleAccessControlSftpEventListenerTest extends BaseTestSupport {
                 new SftpSubsystemFactory.Builder();
         builder.addSftpEventListener(SimpleAccessControlSftpEventListener.READ_ONLY_ACCESSOR);
         sshd.setSubsystemFactories(
-                Collections.<NamedFactory<Command>>singletonList(builder.build()));
+                Collections.singletonList(builder.build()));
         sshd.setCommandFactory(new ScpCommandFactory());
         sshd.setFileSystemFactory(fileSystemFactory);
         sshd.start();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentServerProxy.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentServerProxy.java b/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentServerProxy.java
index 30bc5ea..a21a976 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentServerProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentServerProxy.java
@@ -59,7 +59,7 @@ public class AgentServerProxy extends AbstractLoggingBean implements SshAgentSer
                 throw (IOException) t;
             }
 
-            throw (IOException) new IOException("Failed (" + t.getClass().getSimpleName() + ") to create client: " + t.getMessage()).initCause(t);
+            throw (IOException) new IOException("Failed (" + t.getClass().getSimpleName() + ") to create client: " + t.getMessage(), t);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
index 23c301d..ac9fab8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
@@ -57,7 +57,7 @@ public class AgentClient extends AbstractAgentProxy implements Runnable {
         this.authSocket = authSocket;
 
         setExecutorService((executor == null) ? ThreadUtils.newSingleThreadExecutor("AgentClient[" + authSocket + "]") : executor);
-        setShutdownOnExit((executor == null) ? true : shutdownOnExit);
+        setShutdownOnExit((executor == null) || shutdownOnExit);
 
         try {
             pool = Pool.create(AprLibrary.getInstance().getRootPool());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
index c0b3126..d4e6ea1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
@@ -63,7 +63,7 @@ public class AgentServer extends AbstractLoggingBean implements Closeable, Execu
     public AgentServer(SshAgent agent, ExecutorService executor, boolean shutdownOnExit) {
         this.agent = agent;
         this.service = (executor == null) ? ThreadUtils.newSingleThreadExecutor("AgentServer[" + agent + "]") : executor;
-        this.shutdownExecutor = (service == executor) ? shutdownOnExit : true;
+        this.shutdownExecutor = service != executor || shutdownOnExit;
     }
 
     public SshAgent getAgent() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
index 9cb4487..e59265b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
@@ -91,7 +91,7 @@ public class AgentServerProxy extends AbstractLoggingBean implements SshAgentSer
             }
 
             pipeService = (executor == null) ? ThreadUtils.newSingleThreadExecutor("sshd-AgentServerProxy-PIPE-" + authSocket) : executor;
-            pipeCloseOnExit = (executor == pipeService) ? shutdownOnExit : true;
+            pipeCloseOnExit = executor != pipeService || shutdownOnExit;
             piper = pipeService.submit(new Runnable() {
                 @SuppressWarnings("synthetic-access")
                 @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
index f76954b..ef28f34 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
@@ -88,7 +88,7 @@ public class ChannelAgentForwarding extends AbstractServerChannel {
 
             ExecutorService service = getExecutorService();
             forwardService = (service == null) ? ThreadUtils.newSingleThreadExecutor("ChannelAgentForwarding[" + authSocket + "]") : service;
-            shutdownForwarder = (service == forwardService) ? isShutdownOnExit() : true;
+            shutdownForwarder = service != forwardService || isShutdownOnExit();
 
             final int copyBufSize = PropertyResolverUtils.getIntProperty(this, FORWARDER_BUFFER_SIZE, DEFAULT_FORWARDER_BUF_SIZE);
             ValidateUtils.checkTrue(copyBufSize >= MIN_FORWARDER_BUF_SIZE, "Copy buf size below min.: %d", copyBufSize);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java b/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
index afe1f92..ceb4105 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
@@ -142,7 +142,7 @@ public interface ClientAuthenticationManager extends KeyPairProviderHolder {
         setUserAuthFactoriesNames(GenericUtils.split(names, ','));
     }
     default void setUserAuthFactoriesNames(String ... names) {
-        setUserAuthFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.<String>emptyList() : Arrays.asList(names));
+        setUserAuthFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setUserAuthFactoriesNames(Collection<String> names) {
         BuiltinUserAuthFactories.ParseResult result = BuiltinUserAuthFactories.parseFactoriesList(names);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
index 244f285..2cdfca0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
@@ -528,7 +528,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
                     log.debug("connect({}@{}:{}) no overrides", username, host, port);
                 }
 
-                return doConnect(username, address, Collections.<KeyPair>emptyList(), true);
+                return doConnect(username, address, Collections.emptyList(), true);
             } else {
                 if (log.isDebugEnabled()) {
                     log.debug("connect({}@{}:{}) effective: {}", username, host, port, entry);
@@ -540,7 +540,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
             if (log.isDebugEnabled()) {
                 log.debug("connect({}@{}) not an InetSocketAddress: {}", username, address, address.getClass().getName());
             }
-            return doConnect(username, address, Collections.<KeyPair>emptyList(), true);
+            return doConnect(username, address, Collections.emptyList(), true);
         }
     }
 
@@ -1186,7 +1186,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
     public static List<NamedFactory<Compression>> setupCompressions(Map<String, ?> options, PrintStream stderr) {
         String argVal = PropertyResolverUtils.getString(options, SshConfigFileReader.COMPRESSION_PROP);
         if (GenericUtils.isEmpty(argVal)) {
-            return Collections.<NamedFactory<Compression>>emptyList();
+            return Collections.emptyList();
         }
 
         NamedFactory<Compression> value = CompressionConfigValue.fromName(argVal);
@@ -1223,7 +1223,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
     public static List<NamedFactory<Mac>> setupMacs(Map<String, ?> options, PrintStream stderr) {
         String argVal = PropertyResolverUtils.getString(options, SshConfigFileReader.MACS_CONFIG_PROP);
         return GenericUtils.isEmpty(argVal)
-             ? Collections.<NamedFactory<Mac>>emptyList()
+             ? Collections.emptyList()
              : setupMacs(SshConfigFileReader.MACS_CONFIG_PROP, argVal, null, stderr);
     }
 
@@ -1251,7 +1251,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
     public static List<NamedFactory<Cipher>> setupCiphers(Map<String, ?> options, PrintStream stderr) {
         String argVal = PropertyResolverUtils.getString(options, SshConfigFileReader.CIPHERS_CONFIG_PROP);
         return GenericUtils.isEmpty(argVal)
-             ? Collections.<NamedFactory<Cipher>>emptyList()
+             ? Collections.emptyList()
              : setupCiphers(SshConfigFileReader.CIPHERS_CONFIG_PROP, argVal, null, stderr);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java b/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
index dfd8977..7bf4ff6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
@@ -438,9 +438,9 @@ public class SshKeyScan extends AbstractSimplifiedLog
         }
 
         if (BuiltinIdentities.Constants.RSA.equalsIgnoreCase(keyType)) {
-            return Collections.singletonList((NamedFactory<Signature>) BuiltinSignatures.rsa);
+            return Collections.singletonList(BuiltinSignatures.rsa);
         } else if (BuiltinIdentities.Constants.DSA.equalsIgnoreCase(keyType)) {
-            return Collections.singletonList((NamedFactory<Signature>) BuiltinSignatures.dsa);
+            return Collections.singletonList(BuiltinSignatures.dsa);
         } else if (BuiltinIdentities.Constants.ECDSA.equalsIgnoreCase(keyType)) {
             List<NamedFactory<Signature>> factories = new ArrayList<>(ECCurves.NAMES.size());
             for (String n : ECCurves.NAMES) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java
index 27ecb2f..ba40caa 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/BuiltinUserAuthFactories.java
@@ -91,7 +91,7 @@ public enum BuiltinUserAuthFactories implements NamedFactory<UserAuthFactory> {
     }
 
     public static ParseResult parseFactoriesList(String... factories) {
-        return parseFactoriesList(GenericUtils.isEmpty((Object[]) factories) ? Collections.<String>emptyList() : Arrays.asList(factories));
+        return parseFactoriesList(GenericUtils.isEmpty((Object[]) factories) ? Collections.emptyList() : Arrays.asList(factories));
     }
 
     public static ParseResult parseFactoriesList(Collection<String> factories) {
@@ -131,7 +131,7 @@ public enum BuiltinUserAuthFactories implements NamedFactory<UserAuthFactory> {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     public static class ParseResult extends NamedFactoriesListParseResult<UserAuth, UserAuthFactory> {
-        public static final ParseResult EMPTY = new ParseResult(Collections.<UserAuthFactory>emptyList(), Collections.<String>emptyList());
+        public static final ParseResult EMPTY = new ParseResult(Collections.emptyList(), Collections.emptyList());
 
         public ParseResult(List<UserAuthFactory> parsed, List<String> unsupported) {
             super(parsed, unsupported);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
index 7819422..d7879b5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
@@ -54,7 +54,7 @@ public interface HostKeyIdentityProvider {
         }
 
         public static HostKeyIdentityProvider wrap(KeyPair ... pairs) {
-            return wrap(GenericUtils.isEmpty(pairs) ? Collections.<KeyPair>emptyList() : Arrays.asList(pairs));
+            return wrap(GenericUtils.isEmpty(pairs) ? Collections.emptyList() : Arrays.asList(pairs));
         }
 
         public static HostKeyIdentityProvider wrap(final Iterable<? extends KeyPair> pairs) {
@@ -75,7 +75,7 @@ public interface HostKeyIdentityProvider {
                                 @Override
                                 public Pair<KeyPair, List<X509Certificate>> next() {
                                     KeyPair kp = iter.next();
-                                    return new Pair<KeyPair, List<X509Certificate>>(kp, Collections.<X509Certificate>emptyList());
+                                    return new Pair<KeyPair, List<X509Certificate>>(kp, Collections.emptyList());
                                 }
 
                                 @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java
index a4fdcd9..f1fc526 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserAuthKeyboardInteractive.java
@@ -296,11 +296,8 @@ public class UserAuthKeyboardInteractive extends AbstractUserAuth {
         }
 
         int sepPos = value.lastIndexOf(':');
-        if (sepPos <= passPos) {    // no prompt separator or separator before the password keyword
-            return false;
-        }
+        return sepPos > passPos;
 
-        return true;
     }
 
     public static String getAuthCommandName(int cmd) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
index 8250462..d126594 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
@@ -70,7 +70,7 @@ public interface PasswordIdentityProvider {
             new Transformer<PasswordIdentityProvider, Iterable<String>>() {
                 @Override
                 public Iterable<String> transform(PasswordIdentityProvider p) {
-                    return (p == null) ? Collections.<String>emptyList() : p.loadPasswords();
+                    return (p == null) ? Collections.emptyList() : p.loadPasswords();
                 }
             };
 
@@ -89,7 +89,7 @@ public interface PasswordIdentityProvider {
          * @see ClientSession#getPasswordIdentityProvider()
          */
         public static Iterator<String> iteratorOf(ClientSession session) {
-            return (session == null) ? Collections.<String>emptyIterator() : iteratorOf(session.getRegisteredIdentities(), session.getPasswordIdentityProvider());
+            return (session == null) ? Collections.emptyIterator() : iteratorOf(session.getRegisteredIdentities(), session.getPasswordIdentityProvider());
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
index deb5c4a..e9a8196 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
@@ -83,7 +83,7 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
     protected OpenFuture openFuture;
 
     protected AbstractClientChannel(String type) {
-        this(type, Collections.<RequestHandler<Channel>>emptyList());
+        this(type, Collections.emptyList());
     }
 
     protected AbstractClientChannel(String type, Collection<? extends RequestHandler<Channel>> handlers) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java
index bba9947..08750a3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/PtyCapableChannelSession.java
@@ -188,7 +188,7 @@ public class PtyCapableChannelSession extends ChannelSession {
     }
 
     public void setPtyModes(Map<PtyMode, Integer> ptyModes) {
-        this.ptyModes = (ptyModes == null) ? Collections.<PtyMode, Integer>emptyMap() : ptyModes;
+        this.ptyModes = (ptyModes == null) ? Collections.emptyMap() : ptyModes;
     }
 
     public void setEnv(String key, String value) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
index 1d3fc09..1a18556 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
@@ -242,7 +242,7 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
     }
 
     public void setIdentities(Collection<String> identities) {
-        this.identities = (identities == null) ? Collections.<String>emptyList() : identities;
+        this.identities = (identities == null) ? Collections.emptyList() : identities;
     }
 
     /**
@@ -550,7 +550,7 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
      * <U>case insensitive</U> key mapper.
      */
     public void setProperties(Map<String, String> properties) {
-        this.properties = (properties == null) ? Collections.<String, String>emptyMap() : properties;
+        this.properties = (properties == null) ? Collections.emptyMap() : properties;
     }
 
     public <A extends Appendable> A append(A sb) throws IOException {
@@ -639,7 +639,7 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
      * @see #appendNonEmptyValues(Appendable, String, Collection)
      */
     public static <A extends Appendable> A appendNonEmptyValues(A sb, String name, Object ... values) throws IOException {
-        return appendNonEmptyValues(sb, name, GenericUtils.isEmpty(values) ? Collections.<Object>emptyList() : Arrays.asList(values));
+        return appendNonEmptyValues(sb, name, GenericUtils.isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
     }
 
     /**
@@ -725,7 +725,7 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
             return normal;
         }
 
-        normal.setIdentities(Collections.<String>emptyList());  // start fresh
+        normal.setIdentities(Collections.emptyList());  // start fresh
         for (String id : ids) {
             String path = resolveIdentityFilePath(id, host, port, username);
             normal.addIdentity(path);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
index 4878458..58c95a1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
@@ -208,7 +208,7 @@ public abstract class HostPatternsHolder {
     }
 
     public static List<Pair<Pattern, Boolean>> parsePatterns(CharSequence ... patterns) {
-        return parsePatterns(GenericUtils.isEmpty(patterns) ? Collections.<CharSequence>emptyList() : Arrays.asList(patterns));
+        return parsePatterns(GenericUtils.isEmpty(patterns) ? Collections.emptyList() : Arrays.asList(patterns));
     }
 
     public static List<Pair<Pattern, Boolean>> parsePatterns(Collection<? extends CharSequence> patterns) {
@@ -302,9 +302,6 @@ public abstract class HostPatternsHolder {
         if ("-_.".indexOf(ch) >= 0) {
             return true;
         }
-        if (PATTERN_CHARS.indexOf(ch) >= 0) {
-            return true;
-        }
-        return false;
+        return PATTERN_CHARS.indexOf(ch) >= 0;
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java
index eb207ac..a9361c6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java
@@ -57,7 +57,7 @@ public class DefaultConnectFuture extends DefaultVerifiableSshFuture<ConnectFutu
         } else if (v instanceof Error) {
             throw (Error) v;
         } else if (v instanceof Throwable) {
-            throw (RuntimeSshException) new RuntimeSshException("Failed to get the session.").initCause((Throwable) v);
+            throw (RuntimeSshException) new RuntimeSshException("Failed to get the session.", (Throwable) v);
         } else if (v instanceof ClientSession) {
             return (ClientSession) v;
         } else {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
index 1a7c6ce..e62d4b3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
@@ -117,7 +117,7 @@ public class KnownHostsServerKeyVerifier
     protected final Object updateLock = new Object();
     private final ServerKeyVerifier delegate;
     private final AtomicReference<Collection<HostEntryPair>> keysHolder =
-            new AtomicReference<Collection<HostEntryPair>>(Collections.<HostEntryPair>emptyList());
+            new AtomicReference<Collection<HostEntryPair>>(Collections.emptyList());
     private ModifiedServerKeyAcceptor modKeyAcceptor;
 
     public KnownHostsServerKeyVerifier(ServerKeyVerifier delegate, Path file) {
@@ -164,7 +164,7 @@ public class KnownHostsServerKeyVerifier
                         log.debug("verifyServerKey({})[{}] missing known hosts file {}",
                                   clientSession, remoteAddress, file);
                     }
-                    knownHosts = Collections.<HostEntryPair>emptyList();
+                    knownHosts = Collections.emptyList();
                 }
 
                 setLoadedHostsEntries(knownHosts);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
index d750e5c..f411a01 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
@@ -78,7 +78,7 @@ public class DefaultScpClient extends AbstractScpClient {
 
     @Override
     public void download(String remote, OutputStream local) throws IOException {
-        String cmd = ScpClient.createReceiveCommand(remote, Collections.<Option>emptyList());
+        String cmd = ScpClient.createReceiveCommand(remote, Collections.emptyList());
         ClientSession session = getClientSession();
         ChannelExec channel = openCommandChannel(session, cmd);
         try (InputStream invOut = channel.getInvertedOut();
@@ -117,7 +117,7 @@ public class DefaultScpClient extends AbstractScpClient {
         final String name = (namePos < 0)
                 ? remote
                 : ValidateUtils.checkNotNullAndNotEmpty(remote.substring(namePos + 1), "No name value in remote=%s", remote);
-        final String cmd = ScpClient.createSendCommand(remote, (time != null) ? EnumSet.of(Option.PreserveAttributes) : Collections.<Option>emptySet());
+        final String cmd = ScpClient.createSendCommand(remote, (time != null) ? EnumSet.of(Option.PreserveAttributes) : Collections.emptySet());
         ClientSession session = getClientSession();
         ChannelExec channel = openCommandChannel(session, cmd);
         try (InputStream invOut = channel.getInvertedOut();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
index ab895e0..b525032 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
@@ -89,7 +89,7 @@ public interface ClientSession
         TIMEOUT,
         CLOSED,
         WAIT_AUTH,
-        AUTHED;
+        AUTHED
     }
 
     Set<ClientChannelEvent> REMOTE_COMMAND_WAIT_EVENTS =

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
index 49d09f8..82527ab 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
@@ -460,7 +460,7 @@ public interface SftpClient extends SubsystemClient {
      * @see #open(String, Collection)
      */
     default CloseableHandle open(String path) throws IOException {
-        return open(path, Collections.<OpenMode>emptySet());
+        return open(path, Collections.emptySet());
     }
 
     /**
@@ -503,7 +503,7 @@ public interface SftpClient extends SubsystemClient {
     void remove(String path) throws IOException;
 
     default void rename(String oldPath, String newPath) throws IOException {
-        rename(oldPath, newPath, Collections.<CopyMode>emptySet());
+        rename(oldPath, newPath, Collections.emptySet());
     }
 
     default void rename(String oldPath, String newPath, CopyMode... options) throws IOException {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileChannel.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileChannel.java
index 43e6c8c..941ee23 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileChannel.java
@@ -199,7 +199,7 @@ public class SftpFileChannel extends FileChannel {
 
     @Override
     public long position() throws IOException {
-        ensureOpen(Collections.<SftpClient.OpenMode>emptySet());
+        ensureOpen(Collections.emptySet());
         return posTracker.get();
     }
 
@@ -209,27 +209,27 @@ public class SftpFileChannel extends FileChannel {
             throw new IllegalArgumentException("position(" + p + ") illegal file channel position: " + newPosition);
         }
 
-        ensureOpen(Collections.<SftpClient.OpenMode>emptySet());
+        ensureOpen(Collections.emptySet());
         posTracker.set(newPosition);
         return this;
     }
 
     @Override
     public long size() throws IOException {
-        ensureOpen(Collections.<SftpClient.OpenMode>emptySet());
+        ensureOpen(Collections.emptySet());
         return sftp.stat(handle).getSize();
     }
 
     @Override
     public FileChannel truncate(long size) throws IOException {
-        ensureOpen(Collections.<SftpClient.OpenMode>emptySet());
+        ensureOpen(Collections.emptySet());
         sftp.setStat(handle, new SftpClient.Attributes().size(size));
         return this;
     }
 
     @Override
     public void force(boolean metaData) throws IOException {
-        ensureOpen(Collections.<SftpClient.OpenMode>emptySet());
+        ensureOpen(Collections.emptySet());
     }
 
     @Override
@@ -317,7 +317,7 @@ public class SftpFileChannel extends FileChannel {
 
     @Override
     public FileLock tryLock(final long position, final long size, boolean shared) throws IOException {
-        ensureOpen(Collections.<SftpClient.OpenMode>emptySet());
+        ensureOpen(Collections.emptySet());
 
         try {
             sftp.lock(handle, position, size, 0);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java
index bfc8100..48b10d2 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemProvider.java
@@ -284,7 +284,7 @@ public class SftpFileSystemProvider extends FileSystemProvider {
     // NOTE: URI parameters override environment ones
     public static Map<String, Object> resolveFileSystemParameters(Map<String, ?> env, Map<String, Object> uriParams) {
         if (GenericUtils.isEmpty(env)) {
-            return GenericUtils.isEmpty(uriParams) ? Collections.<String, Object>emptyMap() : uriParams;
+            return GenericUtils.isEmpty(uriParams) ? Collections.emptyMap() : uriParams;
         } else if (GenericUtils.isEmpty(uriParams)) {
             return Collections.unmodifiableMap(env);
         }
@@ -1235,7 +1235,7 @@ public class SftpFileSystemProvider extends FileSystemProvider {
     }
 
     public static URI createFileSystemURI(String host, int port, String username, String password) {
-        return createFileSystemURI(host, port, username, password, Collections.<String, Object>emptyMap());
+        return createFileSystemURI(host, port, username, password, Collections.emptyMap());
     }
 
     public static URI createFileSystemURI(String host, int port, String username, String password, Map<String, ?> params) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
index 46a1235..949cca3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
@@ -47,11 +47,11 @@ public abstract class AbstractSftpClientExtension extends AbstractLoggingBean im
     private final boolean supported;
 
     protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Collection<String> extras) {
-        this(name, client, raw, GenericUtils.isEmpty(extras) ? false : extras.contains(name));
+        this(name, client, raw, !GenericUtils.isEmpty(extras) && extras.contains(name));
     }
 
     protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) {
-        this(name, client, raw, GenericUtils.isEmpty(extensions) ? false : extensions.containsKey(name));
+        this(name, client, raw, !GenericUtils.isEmpty(extensions) && extensions.containsKey(name));
     }
 
     protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, boolean supported) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java b/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
index 698e6e2..707cb81 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/SyspropsMapWrapper.java
@@ -107,7 +107,7 @@ public final class SyspropsMapWrapper implements Map<String, Object> {
         Properties props = System.getProperties();
         // return a copy in order to avoid concurrent modifications
         Set<Entry<String, Object>> entries =
-                new TreeSet<Entry<String, Object>>(Pair.<String, Object>byKeyEntryComparator());
+                new TreeSet<Entry<String, Object>>(Pair.byKeyEntryComparator());
         for (String key : props.stringPropertyNames()) {
             if (!isMappedSyspropKey(key)) {
                 continue;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
index c99f6f3..b2e4c1c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
@@ -85,7 +85,7 @@ public abstract class AbstractChannel
      * Channel events listener
      */
     protected final Collection<ChannelListener> channelListeners =
-            EventListenerUtils.<ChannelListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     protected final ChannelListener channelListenerProxy;
 
     private int id = -1;
@@ -113,7 +113,7 @@ public abstract class AbstractChannel
     }
 
     protected AbstractChannel(String discriminator, boolean client) {
-        this(discriminator, client, Collections.<RequestHandler<Channel>>emptyList());
+        this(discriminator, client, Collections.emptyList());
     }
 
     protected AbstractChannel(String discriminator, boolean client, Collection<? extends RequestHandler<Channel>> handlers) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelAsyncInputStream.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelAsyncInputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelAsyncInputStream.java
index 1e2a751..1accc85 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelAsyncInputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelAsyncInputStream.java
@@ -166,7 +166,7 @@ public class ChannelAsyncInputStream extends AbstractCloseable implements IoInpu
             } else if (v instanceof Error) {
                 throw (Error) v;
             } else if (v instanceof Throwable) {
-                throw (RuntimeSshException) new RuntimeSshException("Error reading from channel.").initCause((Throwable) v);
+                throw (RuntimeSshException) new RuntimeSshException("Error reading from channel.", (Throwable) v);
             } else if (v instanceof Number) {
                 return ((Number) v).intValue();
             } else {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
index fa92fe1..355a469 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
@@ -245,11 +245,9 @@ public final class SttySupport {
      */
     public static String exec(final String cmd)
             throws IOException, InterruptedException {
-        return exec(new String[] {
-            "sh",
-            "-c",
-            cmd
-        });
+        return exec("sh",
+                "-c",
+                cmd);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java
index 23548f1..d85e51d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/Window.java
@@ -65,7 +65,7 @@ public class Window extends AbstractLoggingBean implements java.nio.channels.Cha
 
     private int maxSize;
     private int packetSize;
-    private Map<String, Object> props = Collections.<String, Object>emptyMap();
+    private Map<String, Object> props = Collections.emptyMap();
 
     public Window(AbstractChannel channel, Object lock, boolean client, boolean local) {
         this.channelInstance = ValidateUtils.checkNotNull(channel, "No channel provided");
@@ -115,7 +115,7 @@ public class Window extends AbstractLoggingBean implements java.nio.channels.Cha
         synchronized (lock) {
             this.maxSize = size;
             this.packetSize = packetSize;
-            this.props = (props == null) ? Collections.<String, Object>emptyMap() : props;
+            this.props = (props == null) ? Collections.emptyMap() : props;
             updateSize(size);
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java b/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java
index 4038440..409bade 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/cipher/BuiltinCiphers.java
@@ -251,7 +251,7 @@ public enum BuiltinCiphers implements CipherFactory {
     }
 
     public static ParseResult parseCiphersList(String... ciphers) {
-        return parseCiphersList(GenericUtils.isEmpty((Object[]) ciphers) ? Collections.<String>emptyList() : Arrays.asList(ciphers));
+        return parseCiphersList(GenericUtils.isEmpty((Object[]) ciphers) ? Collections.emptyList() : Arrays.asList(ciphers));
     }
 
     public static ParseResult parseCiphersList(Collection<String> ciphers) {
@@ -303,7 +303,7 @@ public enum BuiltinCiphers implements CipherFactory {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     public static class ParseResult extends NamedFactoriesListParseResult<Cipher, CipherFactory> {
-        public static final ParseResult EMPTY = new ParseResult(Collections.<CipherFactory>emptyList(), Collections.<String>emptyList());
+        public static final ParseResult EMPTY = new ParseResult(Collections.emptyList(), Collections.emptyList());
 
         public ParseResult(List<CipherFactory> parsed, List<String> unsupported) {
             super(parsed, unsupported);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java b/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java
index e27e4a6..8365226 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/compression/BuiltinCompressions.java
@@ -166,7 +166,7 @@ public enum BuiltinCompressions implements CompressionFactory {
     }
 
     public static ParseResult parseCompressionsList(String... compressions) {
-        return parseCompressionsList(GenericUtils.isEmpty((Object[]) compressions) ? Collections.<String>emptyList() : Arrays.asList(compressions));
+        return parseCompressionsList(GenericUtils.isEmpty((Object[]) compressions) ? Collections.emptyList() : Arrays.asList(compressions));
     }
 
     public static ParseResult parseCompressionsList(Collection<String> compressions) {
@@ -218,7 +218,7 @@ public enum BuiltinCompressions implements CompressionFactory {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     public static class ParseResult extends NamedFactoriesListParseResult<Compression, CompressionFactory> {
-        public static final ParseResult EMPTY = new ParseResult(Collections.<CompressionFactory>emptyList(), Collections.<String>emptyList());
+        public static final ParseResult EMPTY = new ParseResult(Collections.emptyList(), Collections.emptyList());
 
         public ParseResult(List<CompressionFactory> parsed, List<String> unsupported) {
             super(parsed, unsupported);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java b/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
index 4b08beb..35ba82a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/SshConfigFileReader.java
@@ -599,7 +599,7 @@ public final class SshConfigFileReader {
         CompressionFactory factory = CompressionConfigValue.fromName(value);
         ValidateUtils.checkTrue(lenient || (factory != null), "Unsupported compression value: %s", value);
         if ((factory != null) && factory.isSupported()) {
-            manager.setCompressionFactories(Collections.<NamedFactory<Compression>>singletonList(factory));
+            manager.setCompressionFactories(Collections.singletonList(factory));
         }
 
         return manager;
@@ -613,7 +613,7 @@ public final class SshConfigFileReader {
         if (factory != null) {
             // SSH can work without compression
             if (ignoreUnsupported || factory.isSupported()) {
-                manager.setCompressionFactories(Collections.<NamedFactory<Compression>>singletonList(factory));
+                manager.setCompressionFactories(Collections.singletonList(factory));
             }
         } else {
             BuiltinCompressions.ParseResult result = BuiltinCompressions.parseCompressionsList(value);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java b/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java
index ad4d981..83e9003 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/TimeValueConfig.java
@@ -96,7 +96,7 @@ public enum TimeValueConfig {
      * @throws NumberFormatException    If bad numbers found - e.g., negative counts
      * @throws IllegalArgumentException If bad format - e.g., unknown unit
      */
-    public static Map<TimeValueConfig, Long> parse(String s) throws NumberFormatException, IllegalArgumentException {
+    public static Map<TimeValueConfig, Long> parse(String s) throws IllegalArgumentException {
         if (GenericUtils.isEmpty(s)) {
             return Collections.emptyMap();
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java b/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
index 8d69916..169daa1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java
@@ -67,7 +67,7 @@ public abstract class BaseFileSystem<T extends Path> extends FileSystem {
 
     @Override
     public Iterable<Path> getRootDirectories() {
-        return Collections.<Path>singleton(create("/"));
+        return Collections.singleton(create("/"));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/file/util/BasePath.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/util/BasePath.java b/sshd-core/src/main/java/org/apache/sshd/common/file/util/BasePath.java
index 5e42099..b2bbf42 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/file/util/BasePath.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/file/util/BasePath.java
@@ -275,7 +275,7 @@ public abstract class BasePath<T extends BasePath<T, FS>, FS extends BaseFileSys
         }
         int extraNamesInThis = Math.max(0, p1.names.size() - sharedSubsequenceLength);
         List<String> extraNamesInOther = (p2.names.size() <= sharedSubsequenceLength)
-                ? Collections.<String>emptyList()
+                ? Collections.emptyList()
                 : p2.names.subList(sharedSubsequenceLength, p2.names.size());
         List<String> parts = new ArrayList<>(extraNamesInThis + extraNamesInOther.size());
         // add .. for each extra name in this path

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/file/virtualfs/VirtualFileSystemFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/virtualfs/VirtualFileSystemFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/file/virtualfs/VirtualFileSystemFactory.java
index 60921c8..abfc9b9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/file/virtualfs/VirtualFileSystemFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/file/virtualfs/VirtualFileSystemFactory.java
@@ -72,7 +72,7 @@ public class VirtualFileSystemFactory implements FileSystemFactory {
             throw new InvalidPathException(username, "Cannot resolve home directory");
         }
 
-        return new RootedFileSystemProvider().newFileSystem(dir, Collections.<String, Object>emptyMap());
+        return new RootedFileSystemProvider().newFileSystem(dir, Collections.emptyMap());
     }
 
     protected Path computeRootDir(Session session) throws IOException  {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java
index aba9317..48c8e1c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java
@@ -104,7 +104,7 @@ public class DefaultTcpipForwarder
         }
     };
     private final Collection<PortForwardingEventListener> listeners =
-            EventListenerUtils.<PortForwardingEventListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     private final PortForwardingEventListener listenerProxy;
 
     private IoAcceptor acceptor;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarderFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarderFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarderFactory.java
index e7de9c3..b100524 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarderFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarderFactory.java
@@ -43,7 +43,7 @@ public class DefaultTcpipForwarderFactory implements TcpipForwarderFactory, Port
     };
 
     private final Collection<PortForwardingEventListener> listeners =
-            EventListenerUtils.<PortForwardingEventListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     private final PortForwardingEventListener listenerProxy;
 
     public DefaultTcpipForwarderFactory() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
index 48a78f2..415d101 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/helpers/AbstractFactoryManager.java
@@ -79,13 +79,13 @@ public abstract class AbstractFactoryManager extends AbstractKexFactoryManager i
     protected SessionTimeoutListener sessionTimeoutListener;
     protected ScheduledFuture<?> timeoutListenerFuture;
     protected final Collection<SessionListener> sessionListeners =
-            EventListenerUtils.<SessionListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     protected final SessionListener sessionListenerProxy;
     protected final Collection<ChannelListener> channelListeners =
-            EventListenerUtils.<ChannelListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     protected final ChannelListener channelListenerProxy;
     protected final Collection<PortForwardingEventListener> tunnelListeners =
-            EventListenerUtils.<PortForwardingEventListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     protected final PortForwardingEventListener tunnelListenerProxy;
 
     private final Map<String, Object> properties = new ConcurrentHashMap<>();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/kex/AbstractKexFactoryManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/AbstractKexFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/AbstractKexFactoryManager.java
index e86e579..df4bead 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/AbstractKexFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/AbstractKexFactoryManager.java
@@ -56,7 +56,7 @@ public abstract class AbstractKexFactoryManager
     @Override
     public List<NamedFactory<KeyExchange>> getKeyExchangeFactories() {
         return resolveEffectiveFactories(KeyExchange.class, keyExchangeFactories,
-                (parent == null) ? Collections.<NamedFactory<KeyExchange>>emptyList() : parent.getKeyExchangeFactories());
+                (parent == null) ? Collections.emptyList() : parent.getKeyExchangeFactories());
     }
 
     @Override
@@ -67,7 +67,7 @@ public abstract class AbstractKexFactoryManager
     @Override
     public List<NamedFactory<Cipher>> getCipherFactories() {
         return resolveEffectiveFactories(Cipher.class, cipherFactories,
-                (parent == null) ? Collections.<NamedFactory<Cipher>>emptyList() : parent.getCipherFactories());
+                (parent == null) ? Collections.emptyList() : parent.getCipherFactories());
     }
 
     @Override
@@ -78,7 +78,7 @@ public abstract class AbstractKexFactoryManager
     @Override
     public List<NamedFactory<Compression>> getCompressionFactories() {
         return resolveEffectiveFactories(Compression.class, compressionFactories,
-                (parent == null) ? Collections.<NamedFactory<Compression>>emptyList() : parent.getCompressionFactories());
+                (parent == null) ? Collections.emptyList() : parent.getCompressionFactories());
     }
 
     @Override
@@ -89,7 +89,7 @@ public abstract class AbstractKexFactoryManager
     @Override
     public List<NamedFactory<Mac>> getMacFactories() {
         return resolveEffectiveFactories(Mac.class, macFactories,
-                (parent == null) ? Collections.<NamedFactory<Mac>>emptyList() : parent.getMacFactories());
+                (parent == null) ? Collections.emptyList() : parent.getMacFactories());
     }
 
     @Override
@@ -100,7 +100,7 @@ public abstract class AbstractKexFactoryManager
     @Override
     public List<NamedFactory<Signature>> getSignatureFactories() {
         return resolveEffectiveFactories(Signature.class, signatureFactories,
-                (parent == null) ? Collections.<NamedFactory<Signature>>emptyList() : parent.getSignatureFactories());
+                (parent == null) ? Collections.emptyList() : parent.getSignatureFactories());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
index b2c2f72..a139fa6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
@@ -257,7 +257,7 @@ public enum BuiltinDHFactories implements DHFactory {
     }
 
     public static ParseResult parseDHFactoriesList(String... dhList) {
-        return parseDHFactoriesList(GenericUtils.isEmpty((Object[]) dhList) ? Collections.<String>emptyList() : Arrays.asList(dhList));
+        return parseDHFactoriesList(GenericUtils.isEmpty((Object[]) dhList) ? Collections.emptyList() : Arrays.asList(dhList));
     }
 
     public static ParseResult parseDHFactoriesList(Collection<String> dhList) {
@@ -309,7 +309,7 @@ public enum BuiltinDHFactories implements DHFactory {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     public static final class ParseResult extends NamedResourceListParseResult<DHFactory> {
-        public static final ParseResult EMPTY = new ParseResult(Collections.<DHFactory>emptyList(), Collections.<String>emptyList());
+        public static final ParseResult EMPTY = new ParseResult(Collections.emptyList(), Collections.emptyList());
 
         public ParseResult(List<DHFactory> parsed, List<String> unsupported) {
             super(parsed, unsupported);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
index 6776f29..cce5cd1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
@@ -68,7 +68,7 @@ public interface KexFactoryManager extends KeyPairProviderHolder, SignatureFacto
         setCipherFactoriesNames(GenericUtils.split(names, ','));
     }
     default void setCipherFactoriesNames(String ... names) {
-        setCipherFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.<String>emptyList() : Arrays.asList(names));
+        setCipherFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setCipherFactoriesNames(Collection<String> names) {
         BuiltinCiphers.ParseResult result = BuiltinCiphers.parseCiphersList(names);
@@ -98,7 +98,7 @@ public interface KexFactoryManager extends KeyPairProviderHolder, SignatureFacto
         setCompressionFactoriesNames(GenericUtils.split(names, ','));
     }
     default void setCompressionFactoriesNames(String ... names) {
-        setCompressionFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.<String>emptyList() : Arrays.asList(names));
+        setCompressionFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setCompressionFactoriesNames(Collection<String> names) {
         BuiltinCompressions.ParseResult result = BuiltinCompressions.parseCompressionsList(names);
@@ -128,7 +128,7 @@ public interface KexFactoryManager extends KeyPairProviderHolder, SignatureFacto
         setMacFactoriesNames(GenericUtils.split(names, ','));
     }
     default void setMacFactoriesNames(String ... names) {
-        setMacFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.<String>emptyList() : Arrays.asList(names));
+        setMacFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setMacFactoriesNames(Collection<String> names) {
         BuiltinMacs.ParseResult result = BuiltinMacs.parseMacsList(names);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractClassLoadableResourceKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractClassLoadableResourceKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractClassLoadableResourceKeyPairProvider.java
index 4729b5f..967f03b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractClassLoadableResourceKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractClassLoadableResourceKeyPairProvider.java
@@ -49,7 +49,7 @@ public abstract class AbstractClassLoadableResourceKeyPairProvider extends Abstr
     }
 
     public void setResources(Collection<String> resources) {
-        this.resources = (resources == null) ? Collections.<String>emptyList() : resources;
+        this.resources = (resources == null) ? Collections.emptyList() : resources;
     }
 
     public ClassLoader getResourceLoader() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
index e68529e..75d8e08 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractFileKeyPairProvider.java
@@ -54,7 +54,7 @@ public abstract class AbstractFileKeyPairProvider extends AbstractResourceKeyPai
 
     public void setFiles(Collection<File> files) {
         if (GenericUtils.isEmpty(files)) {
-            setPaths(Collections.<Path>emptyList());
+            setPaths(Collections.emptyList());
         } else {
             List<Path> paths = new ArrayList<>(files.size());
             for (File f : files) {
@@ -66,7 +66,7 @@ public abstract class AbstractFileKeyPairProvider extends AbstractResourceKeyPai
 
     public void setPaths(Collection<? extends Path> paths) {
         int numPaths = GenericUtils.size(paths);
-        Collection<Path> resolved = (numPaths <= 0) ? Collections.<Path>emptyList() : new ArrayList<Path>(paths.size());
+        Collection<Path> resolved = (numPaths <= 0) ? Collections.emptyList() : new ArrayList<Path>(paths.size());
         // use absolute path in order to have unique cache keys
         if (numPaths > 0) {
             for (Path p : paths) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
index 4f331aa..cb1e08a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
@@ -74,7 +74,7 @@ public interface KeyIdentityProvider {
             new Transformer<KeyIdentityProvider, Iterable<KeyPair>>() {
                 @Override
                 public Iterable<KeyPair> transform(KeyIdentityProvider p) {
-                    return (p == null) ? Collections.<KeyPair>emptyList() : p.loadKeys();
+                    return (p == null) ? Collections.emptyList() : p.loadKeys();
                 }
             };
 
@@ -94,7 +94,7 @@ public interface KeyIdentityProvider {
          * @see ClientSession#getKeyPairProvider()
          */
         public static Iterator<KeyPair> iteratorOf(ClientSession session) {
-            return (session == null) ? Collections.<KeyPair>emptyIterator() : iteratorOf(session.getRegisteredIdentities(), session.getKeyPairProvider());
+            return (session == null) ? Collections.emptyIterator() : iteratorOf(session.getRegisteredIdentities(), session.getKeyPairProvider());
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
index d988b2d..0b316c0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
@@ -54,7 +54,7 @@ public class MappedKeyPairProvider implements KeyPairProvider {
     private final Map<String, KeyPair> pairsMap;
 
     public MappedKeyPairProvider(KeyPair ... pairs) {
-        this(GenericUtils.isEmpty(pairs) ? Collections.<KeyPair>emptyList() : Arrays.asList(pairs));
+        this(GenericUtils.isEmpty(pairs) ? Collections.emptyList() : Arrays.asList(pairs));
     }
 
     public MappedKeyPairProvider(Collection<? extends KeyPair> pairs) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java b/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java
index 35614d3..3ad7c27 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java
@@ -201,7 +201,7 @@ public enum BuiltinMacs implements MacFactory {
     }
 
     public static ParseResult parseMacsList(String... macs) {
-        return parseMacsList(GenericUtils.isEmpty((Object[]) macs) ? Collections.<String>emptyList() : Arrays.asList(macs));
+        return parseMacsList(GenericUtils.isEmpty((Object[]) macs) ? Collections.emptyList() : Arrays.asList(macs));
     }
 
     public static ParseResult parseMacsList(Collection<String> macs) {
@@ -248,7 +248,7 @@ public enum BuiltinMacs implements MacFactory {
     }
 
     public static final class ParseResult extends NamedFactoriesListParseResult<Mac, MacFactory> {
-        public static final ParseResult EMPTY = new ParseResult(Collections.<MacFactory>emptyList(), Collections.<String>emptyList());
+        public static final ParseResult EMPTY = new ParseResult(Collections.emptyList(), Collections.emptyList());
 
         public ParseResult(List<MacFactory> parsed, List<String> unsupported) {
             super(parsed, unsupported);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractConnectionServiceFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractConnectionServiceFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractConnectionServiceFactory.java
index 76e20c4..779e215 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractConnectionServiceFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractConnectionServiceFactory.java
@@ -32,7 +32,7 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
  */
 public abstract class AbstractConnectionServiceFactory extends AbstractLoggingBean implements PortForwardingEventListenerManager {
     private final Collection<PortForwardingEventListener> listeners =
-            EventListenerUtils.<PortForwardingEventListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     private final PortForwardingEventListener listenerProxy;
 
     protected AbstractConnectionServiceFactory() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
index b5fe252..d9fca41 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
@@ -82,7 +82,7 @@ public interface Session
     enum TimeoutStatus {
         NoTimeout,
         AuthTimeout,
-        IdleTimeout;
+        IdleTimeout
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
index 8e60a67..8aea3a8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
@@ -100,7 +100,7 @@ public abstract class AbstractConnectionService<S extends AbstractSession>
     private final AtomicReference<TcpipForwarder> tcpipForwarderHolder = new AtomicReference<>();
     private final AtomicBoolean allowMoreSessions = new AtomicBoolean(true);
     private final Collection<PortForwardingEventListener> listeners =
-            EventListenerUtils.<PortForwardingEventListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     private final PortForwardingEventListener listenerProxy;
 
     private final S sessionInstance;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
index acf8e70..2ec5e7c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
@@ -135,21 +135,21 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
      * Session listeners container
      */
     protected final Collection<SessionListener> sessionListeners =
-            EventListenerUtils.<SessionListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     protected final SessionListener sessionListenerProxy;
 
     /**
      * Channel events listener container
      */
     protected final Collection<ChannelListener> channelListeners =
-            EventListenerUtils.<ChannelListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     protected final ChannelListener channelListenerProxy;
 
     /**
      * Port forwarding events listener container
      */
     protected final Collection<PortForwardingEventListener> tunnelListeners =
-            EventListenerUtils.<PortForwardingEventListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     protected final PortForwardingEventListener tunnelListenerProxy;
 
     /*
@@ -897,7 +897,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
     protected List<Service> getServices() {
         return (currentService != null)
               ? Collections.singletonList(currentService)
-              : Collections.<Service>emptyList();
+              : Collections.emptyList();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java b/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java
index 50beb8e..acd116e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java
@@ -232,7 +232,7 @@ public enum BuiltinSignatures implements SignatureFactory {
     }
 
     public static ParseResult parseSignatureList(String... sigs) {
-        return parseSignatureList(GenericUtils.isEmpty((Object[]) sigs) ? Collections.<String>emptyList() : Arrays.asList(sigs));
+        return parseSignatureList(GenericUtils.isEmpty((Object[]) sigs) ? Collections.emptyList() : Arrays.asList(sigs));
     }
 
     public static ParseResult parseSignatureList(Collection<String> sigs) {
@@ -284,7 +284,7 @@ public enum BuiltinSignatures implements SignatureFactory {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     public static final class ParseResult extends NamedFactoriesListParseResult<Signature, SignatureFactory> {
-        public static final ParseResult EMPTY = new ParseResult(Collections.<SignatureFactory>emptyList(), Collections.<String>emptyList());
+        public static final ParseResult EMPTY = new ParseResult(Collections.emptyList(), Collections.emptyList());
 
         public ParseResult(List<SignatureFactory> parsed, List<String> unsupported) {
             super(parsed, unsupported);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
index ff07743..5bc3d54 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
@@ -51,7 +51,7 @@ public interface SignatureFactoriesManager {
         setSignatureFactoriesNames(GenericUtils.split(names, ','));
     }
     default void setSignatureFactoriesNames(String ... names) {
-        setSignatureFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.<String>emptyList() : Arrays.asList(names));
+        setSignatureFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setSignatureFactoriesNames(Collection<String> names) {
         BuiltinSignatures.ParseResult result = BuiltinSignatures.parseSignatureList(names);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
index 3859892..f218510 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/AclSupportedParser.java
@@ -103,7 +103,7 @@ public class AclSupportedParser extends AbstractParser<AclCapabilities> {
             private static final String ACL_CAP_NAME_PREFIX = "SSH_ACL_CAP_";
             private static final Map<Integer, String> ACL_VALUES_MAP = LoggingUtils.generateMnemonicMap(SftpConstants.class, ACL_CAP_NAME_PREFIX);
             private static final Map<String, Integer> ACL_NAMES_MAP =
-                    Collections.unmodifiableMap(GenericUtils.flipMap(ACL_VALUES_MAP, GenericUtils.<Integer>caseInsensitiveMap(), false));
+                    Collections.unmodifiableMap(GenericUtils.flipMap(ACL_VALUES_MAP, GenericUtils.caseInsensitiveMap(), false));
         }
 
         @SuppressWarnings("synthetic-access")


[13/16] mina-sshd git commit: [SSHD-698] Use lambda and method references, streams Deprecate Utils inner classes and use interface methods instead.

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java
index f028a3b..d007c07 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java
@@ -100,9 +100,7 @@ public abstract class AbstractResourceKeyPairProvider<R> extends AbstractKeyPair
             }
 
             if (GenericUtils.size(toDelete) > 0) {
-                for (String f : toDelete) {
-                    cacheMap.remove(f);
-                }
+                toDelete.forEach(cacheMap::remove);
             }
         }
 
@@ -115,12 +113,7 @@ public abstract class AbstractResourceKeyPairProvider<R> extends AbstractKeyPair
         if (GenericUtils.isEmpty(resources)) {
             return Collections.emptyList();
         } else {
-            return new Iterable<KeyPair>() {
-                @Override
-                public Iterator<KeyPair> iterator() {
-                    return new KeyPairIterator(resources);
-                }
-            };
+            return () -> new KeyPairIterator(resources);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
index cb1e08a..b696acf 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
@@ -20,12 +20,9 @@
 package org.apache.sshd.common.keyprovider;
 
 import java.security.KeyPair;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.function.Supplier;
 
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.util.GenericUtils;
@@ -53,6 +50,13 @@ public interface KeyIdentityProvider {
     };
 
     /**
+     * Invokes {@link KeyIdentityProvider#loadKeys()} and returns the result - ignores
+     * {@code null} providers (i.e., returns an empty iterable instance)
+     */
+    Transformer<KeyIdentityProvider, Iterable<KeyPair>> LOADER = p ->
+            (p == null) ? Collections.<KeyPair>emptyList() : p.loadKeys();
+
+    /**
      * Load available keys.
      *
      * @return an {@link Iterable} instance of available keys - ignored if {@code null}
@@ -64,167 +68,169 @@ public interface KeyIdentityProvider {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
-        /**
-         * Invokes {@link KeyIdentityProvider#loadKeys()} and returns the result - ignores
-         * {@code null} providers (i.e., returns an empty iterable instance)
-         */
+
         public static final Transformer<KeyIdentityProvider, Iterable<KeyPair>> LOADER =
-            new Transformer<KeyIdentityProvider, Iterable<KeyPair>>() {
-                @Override
-                public Iterable<KeyPair> transform(KeyIdentityProvider p) {
-                    return (p == null) ? Collections.emptyList() : p.loadKeys();
-                }
-            };
+                KeyIdentityProvider.LOADER;
 
         private Utils() {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * Creates a &quot;unified&quot; {@link Iterator} of key pairs out of the registered
-         * {@link KeyPair} identities and the extra available ones as a single iterator
-         * of key pairs
-         *
-         * @param session The {@link ClientSession} - ignored if {@code null} (i.e., empty
-         * iterator returned)
-         * @return The wrapping iterator
-         * @see ClientSession#getRegisteredIdentities()
-         * @see ClientSession#getKeyPairProvider()
-         */
         public static Iterator<KeyPair> iteratorOf(ClientSession session) {
-            return (session == null) ? Collections.emptyIterator() : iteratorOf(session.getRegisteredIdentities(), session.getKeyPairProvider());
+            return KeyIdentityProvider.iteratorOf(session);
         }
 
-        /**
-         * Creates a &quot;unified&quot; {@link Iterator} of {@link KeyPair}s out of 2 possible
-         * {@link KeyIdentityProvider}
-         *
-         * @param identities The registered keys identities
-         * @param keys Extra available key pairs
-         * @return The wrapping iterator
-         * @see #resolveKeyIdentityProvider(KeyIdentityProvider, KeyIdentityProvider)
-         */
         public static Iterator<KeyPair> iteratorOf(KeyIdentityProvider identities, KeyIdentityProvider keys) {
-            return iteratorOf(resolveKeyIdentityProvider(identities, keys));
+            return KeyIdentityProvider.iteratorOf(identities, keys);
         }
 
-        /**
-         * Resolves a non-{@code null} iterator of the available keys
-         *
-         * @param provider The {@link KeyIdentityProvider} - ignored if {@code null}
-         * @return A non-{@code null} iterator - which may be empty if no provider or no keys
-         */
         public static Iterator<KeyPair> iteratorOf(KeyIdentityProvider provider) {
-            return GenericUtils.iteratorOf((provider == null) ? null : provider.loadKeys());
+            return KeyIdentityProvider.iteratorOf(provider);
         }
 
-        /**
-         * <P>Creates a &quot;unified&quot; {@link KeyIdentityProvider} out of 2 possible ones
-         * as follows:</P></BR>
-         * <UL>
-         *      <LI>If both are {@code null} then return {@code null}.</LI>
-         *      <LI>If either one is {@code null} then use the non-{@code null} one.</LI>
-         *      <LI>If both are the same instance then use it.</U>
-         *      <LI>Otherwise, returns a wrapper that groups both providers.</LI>
-         * </UL>
-         * @param identities The registered key pair identities
-         * @param keys The extra available key pairs
-         * @return The resolved provider
-         * @see #multiProvider(KeyIdentityProvider...)
-         */
         public static KeyIdentityProvider resolveKeyIdentityProvider(KeyIdentityProvider identities, KeyIdentityProvider keys) {
-            if ((keys == null) || (identities == keys)) {
-                return identities;
-            } else if (identities == null) {
-                return keys;
-            } else {
-                return multiProvider(identities, keys);
-            }
+            return KeyIdentityProvider.resolveKeyIdentityProvider(identities, keys);
         }
 
-        /**
-         * Wraps a group of {@link KeyIdentityProvider} into a single one
-         *
-         * @param providers The providers - ignored if {@code null}/empty (i.e., returns
-         * {@link #EMPTY_KEYS_PROVIDER})
-         * @return The wrapping provider
-         * @see #multiProvider(Collection)
-         */
         public static KeyIdentityProvider multiProvider(KeyIdentityProvider ... providers) {
-            return GenericUtils.isEmpty(providers) ? EMPTY_KEYS_PROVIDER : multiProvider(Arrays.asList(providers));
+            return KeyIdentityProvider.multiProvider(providers);
         }
 
-        /**
-         * Wraps a group of {@link KeyIdentityProvider} into a single one
-         *
-         * @param providers The providers - ignored if {@code null}/empty (i.e., returns
-         * {@link #EMPTY_KEYS_PROVIDER})
-         * @return The wrapping provider
-         */
         public static KeyIdentityProvider multiProvider(Collection<? extends KeyIdentityProvider> providers) {
-            return GenericUtils.isEmpty(providers) ? EMPTY_KEYS_PROVIDER : wrap(iterableOf(providers));
+            return KeyIdentityProvider.multiProvider(providers);
         }
 
-        /**
-         * Wraps a group of {@link KeyIdentityProvider} into an {@link Iterable} of {@link KeyPair}s
-         *
-         * @param providers The group of providers - ignored if {@code null}/empty (i.e., returns an
-         * empty iterable instance)
-         * @return The wrapping iterable
-         */
         public static Iterable<KeyPair> iterableOf(Collection<? extends KeyIdentityProvider> providers) {
-            if (GenericUtils.isEmpty(providers)) {
-                return Collections.emptyList();
-            }
-
-            Collection<Supplier<Iterable<KeyPair>>> suppliers = new ArrayList<>(providers.size());
-            for (final KeyIdentityProvider p : providers) {
-                if (p == null) {
-                    continue;
-                }
-
-                suppliers.add(new Supplier<Iterable<KeyPair>>() {
-                    @Override
-                    public Iterable<KeyPair> get() {
-                        return p.loadKeys();
-                    }
-                });
-            }
-
-            if (GenericUtils.isEmpty(suppliers)) {
-                return Collections.emptyList();
-            }
-
-            return GenericUtils.multiIterableSuppliers(suppliers);
+            return KeyIdentityProvider.iterableOf(providers);
         }
 
-        /**
-         * Wraps a group of {@link KeyPair}s into a {@link KeyIdentityProvider}
-         *
-         * @param pairs The key pairs - ignored if {@code null}/empty (i.e., returns
-         * {@link #EMPTY_KEYS_PROVIDER}).
-         * @return The provider wrapper
-         */
         public static KeyIdentityProvider wrap(KeyPair ... pairs) {
-            return GenericUtils.isEmpty(pairs) ? EMPTY_KEYS_PROVIDER : wrap(Arrays.asList(pairs));
+            return KeyIdentityProvider.wrap(pairs);
         }
 
-        /**
-         * Wraps a group of {@link KeyPair}s into a {@link KeyIdentityProvider}
-         *
-         * @param pairs The key pairs {@link Iterable} - ignored if {@code null} (i.e., returns
-         * {@link #EMPTY_KEYS_PROVIDER}).
-         * @return The provider wrapper
-         */
         public static KeyIdentityProvider wrap(final Iterable<KeyPair> pairs) {
-            return (pairs == null) ? EMPTY_KEYS_PROVIDER : new KeyIdentityProvider() {
-                @Override
-                public Iterable<KeyPair> loadKeys() {
-                    return pairs;
-                }
-            };
+            return KeyIdentityProvider.wrap(pairs);
         }
     }
+
+    /**
+     * Creates a &quot;unified&quot; {@link Iterator} of key pairs out of the registered
+     * {@link KeyPair} identities and the extra available ones as a single iterator
+     * of key pairs
+     *
+     * @param session The {@link ClientSession} - ignored if {@code null} (i.e., empty
+     * iterator returned)
+     * @return The wrapping iterator
+     * @see ClientSession#getRegisteredIdentities()
+     * @see ClientSession#getKeyPairProvider()
+     */
+    static Iterator<KeyPair> iteratorOf(ClientSession session) {
+        return (session == null) ? Collections.<KeyPair>emptyIterator() : iteratorOf(session.getRegisteredIdentities(), session.getKeyPairProvider());
+    }
+
+    /**
+     * Creates a &quot;unified&quot; {@link Iterator} of {@link KeyPair}s out of 2 possible
+     * {@link KeyIdentityProvider}
+     *
+     * @param identities The registered keys identities
+     * @param keys Extra available key pairs
+     * @return The wrapping iterator
+     * @see #resolveKeyIdentityProvider(KeyIdentityProvider, KeyIdentityProvider)
+     */
+    static Iterator<KeyPair> iteratorOf(KeyIdentityProvider identities, KeyIdentityProvider keys) {
+        return iteratorOf(resolveKeyIdentityProvider(identities, keys));
+    }
+
+    /**
+     * Resolves a non-{@code null} iterator of the available keys
+     *
+     * @param provider The {@link KeyIdentityProvider} - ignored if {@code null}
+     * @return A non-{@code null} iterator - which may be empty if no provider or no keys
+     */
+    static Iterator<KeyPair> iteratorOf(KeyIdentityProvider provider) {
+        return GenericUtils.iteratorOf((provider == null) ? null : provider.loadKeys());
+    }
+
+    /**
+     * <P>Creates a &quot;unified&quot; {@link KeyIdentityProvider} out of 2 possible ones
+     * as follows:</P></BR>
+     * <UL>
+     *      <LI>If both are {@code null} then return {@code null}.</LI>
+     *      <LI>If either one is {@code null} then use the non-{@code null} one.</LI>
+     *      <LI>If both are the same instance then use it.</U>
+     *      <LI>Otherwise, returns a wrapper that groups both providers.</LI>
+     * </UL>
+     * @param identities The registered key pair identities
+     * @param keys The extra available key pairs
+     * @return The resolved provider
+     * @see #multiProvider(KeyIdentityProvider...)
+     */
+    static KeyIdentityProvider resolveKeyIdentityProvider(KeyIdentityProvider identities, KeyIdentityProvider keys) {
+        if ((keys == null) || (identities == keys)) {
+            return identities;
+        } else if (identities == null) {
+            return keys;
+        } else {
+            return multiProvider(identities, keys);
+        }
+    }
+
+    /**
+     * Wraps a group of {@link KeyIdentityProvider} into a single one
+     *
+     * @param providers The providers - ignored if {@code null}/empty (i.e., returns
+     * {@link #EMPTY_KEYS_PROVIDER})
+     * @return The wrapping provider
+     * @see #multiProvider(Collection)
+     */
+    static KeyIdentityProvider multiProvider(KeyIdentityProvider ... providers) {
+        return multiProvider(GenericUtils.asList(providers));
+    }
+
+    /**
+     * Wraps a group of {@link KeyIdentityProvider} into a single one
+     *
+     * @param providers The providers - ignored if {@code null}/empty (i.e., returns
+     * {@link #EMPTY_KEYS_PROVIDER})
+     * @return The wrapping provider
+     */
+    static KeyIdentityProvider multiProvider(Collection<? extends KeyIdentityProvider> providers) {
+        return GenericUtils.isEmpty(providers) ? EMPTY_KEYS_PROVIDER : wrap(iterableOf(providers));
+    }
+
+    /**
+     * Wraps a group of {@link KeyIdentityProvider} into an {@link Iterable} of {@link KeyPair}s
+     *
+     * @param providers The group of providers - ignored if {@code null}/empty (i.e., returns an
+     * empty iterable instance)
+     * @return The wrapping iterable
+     */
+    static Iterable<KeyPair> iterableOf(Collection<? extends KeyIdentityProvider> providers) {
+        return GenericUtils.multiIterableSuppliers(GenericUtils.wrapIterable(providers, p -> p::loadKeys));
+    }
+
+    /**
+     * Wraps a group of {@link KeyPair}s into a {@link KeyIdentityProvider}
+     *
+     * @param pairs The key pairs - ignored if {@code null}/empty (i.e., returns
+     * {@link #EMPTY_KEYS_PROVIDER}).
+     * @return The provider wrapper
+     */
+    static KeyIdentityProvider wrap(KeyPair ... pairs) {
+        return wrap(GenericUtils.asList(pairs));
+    }
+
+    /**
+     * Wraps a group of {@link KeyPair}s into a {@link KeyIdentityProvider}
+     *
+     * @param pairs The key pairs {@link Iterable} - ignored if {@code null} (i.e., returns
+     * {@link #EMPTY_KEYS_PROVIDER}).
+     * @return The provider wrapper
+     */
+    static KeyIdentityProvider wrap(final Iterable<KeyPair> pairs) {
+        return (pairs == null) ? EMPTY_KEYS_PROVIDER : () -> pairs;
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java
index 1a59a8b..84d52ca 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java
@@ -24,10 +24,12 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 import org.apache.sshd.common.cipher.ECCurves;
 import org.apache.sshd.common.config.keys.KeyUtils;
 import org.apache.sshd.common.util.GenericUtils;
+import org.apache.sshd.common.util.ValidateUtils;
 
 /**
  * Provider for key pairs.  This provider is used on the server side to provide
@@ -101,80 +103,100 @@ public interface KeyPairProvider extends KeyIdentityProvider {
      * @param type the type of key to load
      * @return a valid key pair or {@code null} if this type of key is not available
      */
-    KeyPair loadKey(String type);
+    default KeyPair loadKey(String type) {
+        ValidateUtils.checkNotNullAndNotEmpty(type, "No key type to load");
+        return GenericUtils.stream(loadKeys())
+                .filter(key -> type.equals(KeyUtils.getKeyType(key)))
+                .findFirst()
+                .orElse(null);
+    }
 
     /**
      * @return The available {@link Iterable} key types in preferred order - never {@code null}
      */
-    Iterable<String> getKeyTypes();
+    default Iterable<String> getKeyTypes() {
+        return GenericUtils.stream(loadKeys())
+                .map(KeyUtils::getKeyType)
+                .filter(GenericUtils::isNotEmpty)
+                .collect(Collectors.toSet());
+    }
 
     /**
      * A helper class for key-pair providers
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
         private Utils() {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        /**
-         * Wrap the provided {@link KeyPair}s into a {@link KeyPairProvider}
-         *
-         * @param pairs The available pairs - ignored if {@code null}/empty (i.e.,
-         * returns {@link #EMPTY_KEYPAIR_PROVIDER})
-         * @return The provider wrapper
-         * @see #wrap(Iterable)
-         */
         public static KeyPairProvider wrap(KeyPair ... pairs) {
-            return GenericUtils.isEmpty(pairs) ? EMPTY_KEYPAIR_PROVIDER : wrap(Arrays.asList(pairs));
+            return KeyPairProvider.wrap(pairs);
         }
 
-        /**
-         * Wrap the provided {@link KeyPair}s into a {@link KeyPairProvider}
-         *
-         * @param pairs The available pairs {@link Iterable} - ignored if {@code null} (i.e.,
-         * returns {@link #EMPTY_KEYPAIR_PROVIDER})
-         * @return The provider wrapper
-         */
         public static KeyPairProvider wrap(final Iterable<KeyPair> pairs) {
-            return (pairs == null) ? EMPTY_KEYPAIR_PROVIDER : new KeyPairProvider() {
-                @Override
-                public Iterable<KeyPair> loadKeys() {
-                    return pairs;
-                }
+            return KeyPairProvider.wrap(pairs);
+        }
+    }
 
-                @Override
-                public KeyPair loadKey(String type) {
-                    for (KeyPair kp : pairs) {
-                        String t = KeyUtils.getKeyType(kp);
-                        if (Objects.equals(type, t)) {
-                            return kp;
-                        }
-                    }
+    /**
+     * Wrap the provided {@link KeyPair}s into a {@link KeyPairProvider}
+     *
+     * @param pairs The available pairs - ignored if {@code null}/empty (i.e.,
+     * returns {@link #EMPTY_KEYPAIR_PROVIDER})
+     * @return The provider wrapper
+     * @see #wrap(Iterable)
+     */
+    static KeyPairProvider wrap(KeyPair ... pairs) {
+        return GenericUtils.isEmpty(pairs) ? EMPTY_KEYPAIR_PROVIDER : wrap(Arrays.asList(pairs));
+    }
+
+    /**
+     * Wrap the provided {@link KeyPair}s into a {@link KeyPairProvider}
+     *
+     * @param pairs The available pairs {@link Iterable} - ignored if {@code null} (i.e.,
+     * returns {@link #EMPTY_KEYPAIR_PROVIDER})
+     * @return The provider wrapper
+     */
+    static KeyPairProvider wrap(final Iterable<KeyPair> pairs) {
+        return (pairs == null) ? EMPTY_KEYPAIR_PROVIDER : new KeyPairProvider() {
+            @Override
+            public Iterable<KeyPair> loadKeys() {
+                return pairs;
+            }
 
-                    return null;
+            @Override
+            public KeyPair loadKey(String type) {
+                for (KeyPair kp : pairs) {
+                    String t = KeyUtils.getKeyType(kp);
+                    if (Objects.equals(type, t)) {
+                        return kp;
+                    }
                 }
 
-                @Override
-                public Iterable<String> getKeyTypes() {
-                    // use a LinkedHashSet so as to preserve the order but avoid duplicates
-                    Collection<String> types = new LinkedHashSet<>();
-                    for (KeyPair kp : pairs) {
-                        String t = KeyUtils.getKeyType(kp);
-                        if (GenericUtils.isEmpty(t)) {
-                            continue;   // avoid unknown key types
-                        }
-
-                        if (!types.add(t)) {
-                            continue;   // debug breakpoint
-                        }
+                return null;
+            }
+
+            @Override
+            public Iterable<String> getKeyTypes() {
+                // use a LinkedHashSet so as to preserve the order but avoid duplicates
+                Collection<String> types = new LinkedHashSet<>();
+                for (KeyPair kp : pairs) {
+                    String t = KeyUtils.getKeyType(kp);
+                    if (GenericUtils.isEmpty(t)) {
+                        continue;   // avoid unknown key types
                     }
 
-                    return types;
+                    if (!types.add(t)) {
+                        continue;   // debug breakpoint
+                    }
                 }
-            };
-        }
+
+                return types;
+            }
+        };
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
index 60a2750..42a7102 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
@@ -44,12 +44,7 @@ public class MappedKeyPairProvider implements KeyPairProvider {
      * associated {@link KeyPair}
      */
     public static final Transformer<Map<String, KeyPair>, KeyPairProvider> MAP_TO_KEY_PAIR_PROVIDER =
-        new Transformer<Map<String, KeyPair>, KeyPairProvider>() {
-            @Override
-            public KeyPairProvider transform(final Map<String, KeyPair> input) {
-                return new MappedKeyPairProvider(input);
-            }
-        };
+            MappedKeyPairProvider::new;
 
     private final Map<String, KeyPair> pairsMap;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java b/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java
index 3ad7c27..30b383e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/mac/BuiltinMacs.java
@@ -186,7 +186,7 @@ public enum BuiltinMacs implements MacFactory {
      * (case <U>insensitive</U>) the provided name - {@code null} if no match
      */
     public static BuiltinMacs fromFactoryName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
index 8c0c17f..ad2867f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpHelper.java
@@ -121,46 +121,43 @@ public class ScpHelper extends AbstractLoggingBean implements SessionHolder<Sess
     }
 
     public void receiveFileStream(final OutputStream local, final int bufferSize) throws IOException {
-        receive(new ScpReceiveLineHandler() {
-            @Override
-            public void process(final String line, boolean isDir, ScpTimestamp timestamp) throws IOException {
-                if (isDir) {
-                    throw new StreamCorruptedException("Cannot download a directory into a file stream: " + line);
-                }
+        receive((line, isDir, timestamp) -> {
+            if (isDir) {
+                throw new StreamCorruptedException("Cannot download a directory into a file stream: " + line);
+            }
 
-                final Path path = new MockPath(line);
-                receiveStream(line, new ScpTargetStreamResolver() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public OutputStream resolveTargetStream(Session session, String name, long length,
-                            Set<PosixFilePermission> perms, OpenOption... options) throws IOException {
-                        if (log.isDebugEnabled()) {
-                            log.debug("resolveTargetStream({}) name={}, perms={}, len={} - started local stream download",
-                                      ScpHelper.this, name, perms, length);
-                        }
-                        return local;
+            final Path path = new MockPath(line);
+            receiveStream(line, new ScpTargetStreamResolver() {
+                @SuppressWarnings("synthetic-access")
+                @Override
+                public OutputStream resolveTargetStream(Session session, String name, long length,
+                        Set<PosixFilePermission> perms, OpenOption... options) throws IOException {
+                    if (log.isDebugEnabled()) {
+                        log.debug("resolveTargetStream({}) name={}, perms={}, len={} - started local stream download",
+                                  ScpHelper.this, name, perms, length);
                     }
+                    return local;
+                }
 
-                    @Override
-                    public Path getEventListenerFilePath() {
-                        return path;
-                    }
+                @Override
+                public Path getEventListenerFilePath() {
+                    return path;
+                }
 
-                    @Override
-                    @SuppressWarnings("synthetic-access")
-                    public void postProcessReceivedData(String name, boolean preserve, Set<PosixFilePermission> perms, ScpTimestamp time) throws IOException {
-                        if (log.isDebugEnabled()) {
-                            log.debug("postProcessReceivedData({}) name={}, perms={}, preserve={} time={}",
-                                      ScpHelper.this, name, perms, preserve, time);
-                        }
+                @Override
+                @SuppressWarnings("synthetic-access")
+                public void postProcessReceivedData(String name, boolean preserve, Set<PosixFilePermission> perms, ScpTimestamp time) throws IOException {
+                    if (log.isDebugEnabled()) {
+                        log.debug("postProcessReceivedData({}) name={}, perms={}, preserve={} time={}",
+                                  ScpHelper.this, name, perms, preserve, time);
                     }
+                }
 
-                    @Override
-                    public String toString() {
-                        return line;
-                    }
-                }, timestamp, false, bufferSize);
-            }
+                @Override
+                public String toString() {
+                    return line;
+                }
+            }, timestamp, false, bufferSize);
         });
     }
 
@@ -180,14 +177,11 @@ public class ScpHelper extends AbstractLoggingBean implements SessionHolder<Sess
             }
         }
 
-        receive(new ScpReceiveLineHandler() {
-            @Override
-            public void process(String line, boolean isDir, ScpTimestamp time) throws IOException {
-                if (recursive && isDir) {
-                    receiveDir(line, path, time, preserve, bufferSize);
-                } else {
-                    receiveFile(line, path, time, preserve, bufferSize);
-                }
+        receive((line, isDir, time) -> {
+            if (recursive && isDir) {
+                receiveDir(line, path, time, preserve, bufferSize);
+            } else {
+                receiveFile(line, path, time, preserve, bufferSize);
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/session/ConnectionServiceRequestHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/ConnectionServiceRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/session/ConnectionServiceRequestHandler.java
index 3cf8481..a20181c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/ConnectionServiceRequestHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/ConnectionServiceRequestHandler.java
@@ -29,7 +29,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
 public interface ConnectionServiceRequestHandler extends RequestHandler<ConnectionService> {
 
     // required because of generics issues
-    Transformer<ConnectionServiceRequestHandler, RequestHandler<ConnectionService>> SVC2HNDLR = Transformer.Utils.identity();
+    Transformer<ConnectionServiceRequestHandler, RequestHandler<ConnectionService>> SVC2HNDLR = Transformer.identity();
 
     @Override
     Result process(ConnectionService service, String request, boolean wantReply, Buffer buffer) throws Exception;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
index 0eab031..6878a84 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
@@ -31,7 +31,6 @@ import java.util.concurrent.atomic.AtomicReference;
 import org.apache.sshd.agent.common.AgentForwardSupport;
 import org.apache.sshd.agent.common.DefaultAgentForwardSupport;
 import org.apache.sshd.client.channel.AbstractClientChannel;
-import org.apache.sshd.client.future.OpenFuture;
 import org.apache.sshd.common.Closeable;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.NamedFactory;
@@ -46,7 +45,6 @@ import org.apache.sshd.common.channel.Window;
 import org.apache.sshd.common.forward.PortForwardingEventListener;
 import org.apache.sshd.common.forward.TcpipForwarder;
 import org.apache.sshd.common.forward.TcpipForwarderFactory;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.io.AbstractIoWriteFuture;
 import org.apache.sshd.common.io.IoWriteFuture;
 import org.apache.sshd.common.session.ConnectionService;
@@ -84,7 +82,7 @@ public abstract class AbstractConnectionService<S extends AbstractSession>
     /**
      * Default growth factor function used to resize response buffers
      */
-    public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR = Int2IntFunction.Utils.add(Byte.SIZE);
+    public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR = Int2IntFunction.add(Byte.SIZE);
 
     /**
      * Map of channels keyed by the identifier
@@ -540,7 +538,7 @@ public abstract class AbstractConnectionService<S extends AbstractSession>
 
         final Session session = getSession();
         FactoryManager manager = ValidateUtils.checkNotNull(session.getFactoryManager(), "No factory manager");
-        final Channel channel = NamedFactory.Utils.create(manager.getChannelFactories(), type);
+        final Channel channel = NamedFactory.create(manager.getChannelFactories(), type);
         if (channel == null) {
             // TODO add language tag
             sendChannelOpenFailure(buffer, sender, SshConstants.SSH_OPEN_UNKNOWN_CHANNEL_TYPE, "Unsupported channel type: " + type, "");
@@ -548,45 +546,41 @@ public abstract class AbstractConnectionService<S extends AbstractSession>
         }
 
         final int channelId = registerChannel(channel);
-        channel.open(sender, rwsize, rmpsize, buffer).addListener(new SshFutureListener<OpenFuture>() {
-            @Override
-            @SuppressWarnings("synthetic-access")
-            public void operationComplete(OpenFuture future) {
-                try {
-                    if (future.isOpened()) {
-                        Window window = channel.getLocalWindow();
-                        if (log.isDebugEnabled()) {
-                            log.debug("operationComplete({}) send SSH_MSG_CHANNEL_OPEN_CONFIRMATION recipient={}, sender={}, window-size={}, packet-size={}",
-                                      channel, sender, channelId, window.getSize(), window.getPacketSize());
-                        }
-                        Buffer buf = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN_CONFIRMATION, Integer.SIZE);
-                        buf.putInt(sender); // remote (server side) identifier
-                        buf.putInt(channelId);  // local (client side) identifier
-                        buf.putInt(window.getSize());
-                        buf.putInt(window.getPacketSize());
-                        session.writePacket(buf);
-                    } else {
-                        Throwable exception = future.getException();
-                        if (exception != null) {
-                            String message = exception.getMessage();
-                            int reasonCode = 0;
-                            if (exception instanceof OpenChannelException) {
-                                reasonCode = ((OpenChannelException) exception).getReasonCode();
-                            } else {
-                                message = exception.getClass().getSimpleName() + " while opening channel: " + message;
-                            }
-
-                            Buffer buf = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN_FAILURE, message.length() + Long.SIZE);
-                            sendChannelOpenFailure(buf, sender, reasonCode, message, "");
-                        }
-                    }
-                } catch (IOException e) {
+        channel.open(sender, rwsize, rmpsize, buffer).addListener(future -> {
+            try {
+                if (future.isOpened()) {
+                    Window window = channel.getLocalWindow();
                     if (log.isDebugEnabled()) {
-                        log.debug("operationComplete({}) {}: {}",
-                                  AbstractConnectionService.this, e.getClass().getSimpleName(), e.getMessage());
+                        log.debug("operationComplete({}) send SSH_MSG_CHANNEL_OPEN_CONFIRMATION recipient={}, sender={}, window-size={}, packet-size={}",
+                                  channel, sender, channelId, window.getSize(), window.getPacketSize());
                     }
-                    session.exceptionCaught(e);
+                    Buffer buf = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN_CONFIRMATION, Integer.SIZE);
+                    buf.putInt(sender); // remote (server side) identifier
+                    buf.putInt(channelId);  // local (client side) identifier
+                    buf.putInt(window.getSize());
+                    buf.putInt(window.getPacketSize());
+                    session.writePacket(buf);
+                } else {
+                    Throwable exception = future.getException();
+                    if (exception != null) {
+                        String message = exception.getMessage();
+                        int reasonCode = 0;
+                        if (exception instanceof OpenChannelException) {
+                            reasonCode = ((OpenChannelException) exception).getReasonCode();
+                        } else {
+                            message = exception.getClass().getSimpleName() + " while opening channel: " + message;
+                        }
+
+                        Buffer buf = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN_FAILURE, message.length() + Long.SIZE);
+                        sendChannelOpenFailure(buf, sender, reasonCode, message, "");
+                    }
+                }
+            } catch (IOException e) {
+                if (log.isDebugEnabled()) {
+                    log.debug("operationComplete({}) {}: {}",
+                              AbstractConnectionService.this, e.getClass().getSimpleName(), e.getMessage());
                 }
+                session.exceptionCaught(e);
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
index 3f879e4..290ce96 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
@@ -63,7 +63,6 @@ import org.apache.sshd.common.forward.PortForwardingEventListener;
 import org.apache.sshd.common.future.DefaultKeyExchangeFuture;
 import org.apache.sshd.common.future.DefaultSshFuture;
 import org.apache.sshd.common.future.KeyExchangeFuture;
-import org.apache.sshd.common.future.SshFutureListener;
 import org.apache.sshd.common.io.IoSession;
 import org.apache.sshd.common.io.IoWriteFuture;
 import org.apache.sshd.common.kex.AbstractKexFactoryManager;
@@ -719,7 +718,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
 
         Map<KexProposalOption, String> result = negotiate();
         String kexAlgorithm = result.get(KexProposalOption.ALGORITHMS);
-        kex = ValidateUtils.checkNotNull(NamedFactory.Utils.create(getKeyExchangeFactories(), kexAlgorithm),
+        kex = ValidateUtils.checkNotNull(NamedFactory.create(getKeyExchangeFactories(), kexAlgorithm),
                 "Unknown negotiated KEX algorithm: %s",
                 kexAlgorithm);
         kex.init(this, serverVersion.getBytes(StandardCharsets.UTF_8), clientVersion.getBytes(StandardCharsets.UTF_8), i_s, i_c);
@@ -944,23 +943,14 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
         final IoWriteFuture writeFuture = writePacket(buffer);
         final DefaultSshFuture<IoWriteFuture> future = (DefaultSshFuture<IoWriteFuture>) writeFuture;
         ScheduledExecutorService executor = factoryManager.getScheduledExecutorService();
-        final ScheduledFuture<?> sched = executor.schedule(new Runnable() {
-                @SuppressWarnings("synthetic-access")
-                @Override
-                public void run() {
-                    Throwable t = new TimeoutException("Timeout writing packet: " + timeout + " " + unit);
-                    if (log.isDebugEnabled()) {
-                        log.debug("writePacket({}): {}", AbstractSession.this, t.getMessage());
-                    }
-                    future.setValue(t);
-                }
-            }, timeout, unit);
-        future.addListener(new SshFutureListener<IoWriteFuture>() {
-                @Override
-                public void operationComplete(IoWriteFuture future) {
-                    sched.cancel(false);
-                }
-            });
+        final ScheduledFuture<?> sched = executor.schedule(() -> {
+            Throwable t = new TimeoutException("Timeout writing packet: " + timeout + " " + unit);
+            if (log.isDebugEnabled()) {
+                log.debug("writePacket({}): {}", AbstractSession.this, t.getMessage());
+            }
+            future.setValue(t);
+        }, timeout, unit);
+        future.addListener(future1 -> sched.cancel(false));
         return writeFuture;
     }
 
@@ -1485,21 +1475,21 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
     protected Map<KexProposalOption, String> createProposal(String hostKeyTypes) {
         Map<KexProposalOption, String> proposal = new EnumMap<>(KexProposalOption.class);
         proposal.put(KexProposalOption.ALGORITHMS,
-                NamedResource.Utils.getNames(
+                NamedResource.getNames(
                         ValidateUtils.checkNotNullAndNotEmpty(getKeyExchangeFactories(), "No KEX factories")));
         proposal.put(KexProposalOption.SERVERKEYS, hostKeyTypes);
 
-        String ciphers = NamedResource.Utils.getNames(
+        String ciphers = NamedResource.getNames(
                 ValidateUtils.checkNotNullAndNotEmpty(getCipherFactories(), "No cipher factories"));
         proposal.put(KexProposalOption.S2CENC, ciphers);
         proposal.put(KexProposalOption.C2SENC, ciphers);
 
-        String macs = NamedResource.Utils.getNames(
+        String macs = NamedResource.getNames(
                 ValidateUtils.checkNotNullAndNotEmpty(getMacFactories(), "No MAC factories"));
         proposal.put(KexProposalOption.S2CMAC, macs);
         proposal.put(KexProposalOption.C2SMAC, macs);
 
-        String compressions = NamedResource.Utils.getNames(
+        String compressions = NamedResource.getNames(
                 ValidateUtils.checkNotNullAndNotEmpty(getCompressionFactories(), "No compression factories"));
         proposal.put(KexProposalOption.S2CCOMP, compressions);
         proposal.put(KexProposalOption.C2SCOMP, compressions);
@@ -1672,12 +1662,12 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
         byte[] mac_s2c = hash.digest();
 
         String value = getNegotiatedKexParameter(KexProposalOption.S2CENC);
-        Cipher s2ccipher = ValidateUtils.checkNotNull(NamedFactory.Utils.create(getCipherFactories(), value), "Unknown s2c cipher: %s", value);
+        Cipher s2ccipher = ValidateUtils.checkNotNull(NamedFactory.create(getCipherFactories(), value), "Unknown s2c cipher: %s", value);
         e_s2c = resizeKey(e_s2c, s2ccipher.getBlockSize(), hash, k, h);
         s2ccipher.init(isServer ? Cipher.Mode.Encrypt : Cipher.Mode.Decrypt, e_s2c, iv_s2c);
 
         value = getNegotiatedKexParameter(KexProposalOption.S2CMAC);
-        Mac s2cmac = NamedFactory.Utils.create(getMacFactories(), value);
+        Mac s2cmac = NamedFactory.create(getMacFactories(), value);
         if (s2cmac == null) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_MAC_ERROR, "Unknown s2c MAC: " + value);
         }
@@ -1685,18 +1675,18 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
         s2cmac.init(mac_s2c);
 
         value = getNegotiatedKexParameter(KexProposalOption.S2CCOMP);
-        Compression s2ccomp = NamedFactory.Utils.create(getCompressionFactories(), value);
+        Compression s2ccomp = NamedFactory.create(getCompressionFactories(), value);
         if (s2ccomp == null) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_COMPRESSION_ERROR, "Unknown s2c compression: " + value);
         }
 
         value = getNegotiatedKexParameter(KexProposalOption.C2SENC);
-        Cipher c2scipher = ValidateUtils.checkNotNull(NamedFactory.Utils.create(getCipherFactories(), value), "Unknown c2s cipher: %s", value);
+        Cipher c2scipher = ValidateUtils.checkNotNull(NamedFactory.create(getCipherFactories(), value), "Unknown c2s cipher: %s", value);
         e_c2s = resizeKey(e_c2s, c2scipher.getBlockSize(), hash, k, h);
         c2scipher.init(isServer ? Cipher.Mode.Decrypt : Cipher.Mode.Encrypt, e_c2s, iv_c2s);
 
         value = getNegotiatedKexParameter(KexProposalOption.C2SMAC);
-        Mac c2smac = NamedFactory.Utils.create(getMacFactories(), value);
+        Mac c2smac = NamedFactory.create(getMacFactories(), value);
         if (c2smac == null) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_MAC_ERROR, "Unknown c2s MAC: " + value);
         }
@@ -1704,7 +1694,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
         c2smac.init(mac_c2s);
 
         value = getNegotiatedKexParameter(KexProposalOption.C2SCOMP);
-        Compression c2scomp = NamedFactory.Utils.create(getCompressionFactories(), value);
+        Compression c2scomp = NamedFactory.create(getCompressionFactories(), value);
         if (c2scomp == null) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_COMPRESSION_ERROR, "Unknown c2s compression: " + value);
         }
@@ -1797,30 +1787,26 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
         // Write the packet with a timeout to ensure a timely close of the session
         // in case the consumer does not read packets anymore.
         long disconnectTimeoutMs = PropertyResolverUtils.getLongProperty(this, FactoryManager.DISCONNECT_TIMEOUT, FactoryManager.DEFAULT_DISCONNECT_TIMEOUT);
-        writePacket(buffer, disconnectTimeoutMs, TimeUnit.MILLISECONDS).addListener(new SshFutureListener<IoWriteFuture>() {
-            @Override
-            @SuppressWarnings("synthetic-access")
-            public void operationComplete(IoWriteFuture future) {
-                Throwable t = future.getException();
-                if (log.isDebugEnabled()) {
-                    if (t == null) {
-                        log.debug("disconnect({}) operation successfully completed for reason={} [{}]",
-                                  AbstractSession.this, SshConstants.getDisconnectReasonName(reason), msg);
-                    } else {
-                        log.debug("disconnect({}) operation failed ({}) for reason={} [{}]: {}",
-                                   AbstractSession.this, t.getClass().getSimpleName(),
-                                   SshConstants.getDisconnectReasonName(reason), msg, t.getMessage());
-                    }
+        writePacket(buffer, disconnectTimeoutMs, TimeUnit.MILLISECONDS).addListener(future -> {
+            Throwable t = future.getException();
+            if (log.isDebugEnabled()) {
+                if (t == null) {
+                    log.debug("disconnect({}) operation successfully completed for reason={} [{}]",
+                              AbstractSession.this, SshConstants.getDisconnectReasonName(reason), msg);
+                } else {
+                    log.debug("disconnect({}) operation failed ({}) for reason={} [{}]: {}",
+                               AbstractSession.this, t.getClass().getSimpleName(),
+                               SshConstants.getDisconnectReasonName(reason), msg, t.getMessage());
                 }
+            }
 
-                if (t != null) {
-                    if (log.isTraceEnabled()) {
-                        log.trace("disconnect(" + AbstractSession.this + ") reason=" + SshConstants.getDisconnectReasonName(reason) + " failure details", t);
-                    }
+            if (t != null) {
+                if (log.isTraceEnabled()) {
+                    log.trace("disconnect(" + AbstractSession.this + ") reason=" + SshConstants.getDisconnectReasonName(reason) + " failure details", t);
                 }
-
-                close(true);
             }
+
+            close(true);
         });
     }
 
@@ -1988,7 +1974,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
 
     @Override
     public <T> T resolveAttribute(AttributeKey<T> key) {
-        return AttributeStore.Utils.resolveAttribute(this, key);
+        return AttributeStore.resolveAttribute(this, key);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
index 98025d7..da7818d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
@@ -64,6 +64,7 @@ public class SessionTimeoutListener extends AbstractLoggingBean implements Sessi
         sessionClosed(session);
     }
 
+    @SuppressWarnings("SuspiciousMethodCalls")
     @Override
     public void sessionClosed(Session s) {
         if (sessions.remove(s)) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java b/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java
index acd116e..a586bfe 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/signature/BuiltinSignatures.java
@@ -214,7 +214,7 @@ public enum BuiltinSignatures implements SignatureFactory {
      * (case <U>insensitive</U>) the provided name - {@code null} if no match
      */
     public static BuiltinSignatures fromFactoryName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
index 5bc3d54..2509a39 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
@@ -40,10 +40,10 @@ public interface SignatureFactoriesManager {
      */
     List<NamedFactory<Signature>> getSignatureFactories();
     default String getSignatureFactoriesNameList() {
-        return NamedResource.Utils.getNames(getSignatureFactories());
+        return NamedResource.getNames(getSignatureFactories());
     }
     default List<String> getSignatureFactoriesNames() {
-        return NamedResource.Utils.getNameList(getSignatureFactories());
+        return NamedResource.getNameList(getSignatureFactories());
     }
 
     void setSignatureFactories(List<NamedFactory<Signature>> factories);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java
index a9bb8c4..ac2764a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpConstants.java
@@ -18,9 +18,7 @@
  */
 package org.apache.sshd.common.subsystem.sftp;
 
-import java.lang.reflect.Field;
 import java.util.Map;
-import java.util.function.Predicate;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.logging.LoggingUtils;
@@ -279,16 +277,13 @@ public final class SftpConstants {
 
     private static class LazyCommandNameHolder {
         private static final Map<Integer, String> NAMES_MAP =
-                LoggingUtils.generateMnemonicMap(SftpConstants.class, new Predicate<Field>() {
-                    @Override
-                    public boolean test(Field f) {
-                        String name = f.getName();
-                        return name.startsWith("SSH_FXP_")
-                            // exclude the rename modes which are not opcodes
-                            && (!name.startsWith("SSH_FXP_RENAME_"))
-                            // exclude the realpath modes wich are not opcodes
-                            && (!name.startsWith("SSH_FXP_REALPATH_"));
-                    }
+                LoggingUtils.generateMnemonicMap(SftpConstants.class, f -> {
+                    String name = f.getName();
+                    return name.startsWith("SSH_FXP_")
+                        // exclude the rename modes which are not opcodes
+                        && (!name.startsWith("SSH_FXP_RENAME_"))
+                        // exclude the realpath modes wich are not opcodes
+                        && (!name.startsWith("SSH_FXP_REALPATH_"));
                 });
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroup.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroup.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroup.java
index c8068f1..68ab055 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroup.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpUniversalOwnerAndGroup.java
@@ -62,6 +62,6 @@ public enum SftpUniversalOwnerAndGroup implements NamedResource {
     }
 
     public static SftpUniversalOwnerAndGroup fromName(String name) {
-        return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
+        return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
index 72b16b9..7bd7526 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
@@ -19,8 +19,6 @@
 
 package org.apache.sshd.common.util;
 
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.Collection;
 import java.util.Collections;
@@ -40,55 +38,51 @@ public final class EventListenerUtils {
      * there are no same references in a listener's set
      */
     @SuppressWarnings("checkstyle:anoninnerlength")
-    public static final Comparator<EventListener> LISTENER_INSTANCE_COMPARATOR =
-        new Comparator<EventListener>() {
-            @Override
-            public int compare(EventListener l1, EventListener l2) {
-                if (l1 == l2) {
-                    return 0;
-                } else if (l1 == null) {
-                    return 1;
-                } else if (l2 == null) {
-                    return -1;
-                }
+    public static final Comparator<EventListener> LISTENER_INSTANCE_COMPARATOR = (l1, l2) -> {
+        if (l1 == l2) {
+            return 0;
+        } else if (l1 == null) {
+            return 1;
+        } else if (l2 == null) {
+            return -1;
+        }
 
-                Class<?> c1 = l1.getClass();
-                Class<?> c2 = l2.getClass();
-                boolean checkHashCodes = true;
-                if (Proxy.isProxyClass(c1)) {
-                    if (Proxy.isProxyClass(c2)) {
-                        checkHashCodes = false; // cannot call hashCode on a proxy
-                    } else {
-                        return 1;
-                    }
-                } else if (Proxy.isProxyClass(c2)) {
-                    return -1;
-                }
+        Class<?> c1 = l1.getClass();
+        Class<?> c2 = l2.getClass();
+        boolean checkHashCodes = true;
+        if (Proxy.isProxyClass(c1)) {
+            if (Proxy.isProxyClass(c2)) {
+                checkHashCodes = false; // cannot call hashCode on a proxy
+            } else {
+                return 1;
+            }
+        } else if (Proxy.isProxyClass(c2)) {
+            return -1;
+        }
 
-                if (checkHashCodes) {
-                    int nRes = Integer.compare(l1.hashCode(), l2.hashCode());
-                    if (nRes != 0) {
-                        return nRes;
-                    }
-                }
+        if (checkHashCodes) {
+            int nRes = Integer.compare(l1.hashCode(), l2.hashCode());
+            if (nRes != 0) {
+                return nRes;
+            }
+        }
 
-                int nRes = Integer.compare(System.identityHashCode(l1), System.identityHashCode(l2));
-                if (nRes != 0) {
-                    return nRes;
-                }
+        int nRes = Integer.compare(System.identityHashCode(l1), System.identityHashCode(l2));
+        if (nRes != 0) {
+            return nRes;
+        }
 
-                if (c1 != c2) {
-                    return c1.getName().compareTo(c2.getName());
-                }
+        if (c1 != c2) {
+            return c1.getName().compareTo(c2.getName());
+        }
 
-                String s1 = Objects.toString(l1.toString(), "");
-                String s2 = Objects.toString(l2.toString(), "");
-                nRes = s1.compareTo(s2);
-                if (nRes != 0) {
-                    return nRes;
-                }
-                throw new UnsupportedOperationException("Ran out of options to compare instance of " + s1 + " vs. " + s2);
-            }
+        String s1 = Objects.toString(l1.toString(), "");
+        String s2 = Objects.toString(l2.toString(), "");
+        nRes = s1.compareTo(s2);
+        if (nRes != 0) {
+            return nRes;
+        }
+        throw new UnsupportedOperationException("Ran out of options to compare instance of " + s1 + " vs. " + s2);
     };
 
     private EventListenerUtils() {
@@ -120,7 +114,7 @@ public final class EventListenerUtils {
      * @see #LISTENER_INSTANCE_COMPARATOR
      */
     public static <L extends EventListener> Set<L> synchronizedListenersSet() {
-        return Collections.synchronizedSet(new TreeSet<L>(LISTENER_INSTANCE_COMPARATOR));
+        return Collections.synchronizedSet(new TreeSet<>(LISTENER_INSTANCE_COMPARATOR));
     }
 
     /**
@@ -197,25 +191,22 @@ public final class EventListenerUtils {
         ValidateUtils.checkTrue(listenerType.isInterface(), "Target proxy is not an interface: %s", listenerType.getSimpleName());
         ValidateUtils.checkNotNull(listeners, "No listeners container provided");
 
-        Object wrapper = Proxy.newProxyInstance(loader, new Class<?>[]{listenerType}, new InvocationHandler() {
-            @Override
-            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-                Throwable err = null;
-                for (T l : listeners) {
-                    try {
-                        method.invoke(l, args);
-                    } catch (Throwable t) {
-                        Throwable e = GenericUtils.peelException(t);
-                        err = GenericUtils.accumulateException(err, e);
-                    }
-                }
-
-                if (err != null) {
-                    throw err;
+        Object wrapper = Proxy.newProxyInstance(loader, new Class<?>[]{listenerType}, (proxy, method, args) -> {
+            Throwable err = null;
+            for (T l : listeners) {
+                try {
+                    method.invoke(l, args);
+                } catch (Throwable t) {
+                    Throwable e = GenericUtils.peelException(t);
+                    err = GenericUtils.accumulateException(err, e);
                 }
+            }
 
-                return null;    // we assume always void return value...
+            if (err != null) {
+                throw err;
             }
+
+            return null;    // we assume always void return value...
         });
         return listenerType.cast(wrapper);
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
index ba58385..b8a04d1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
@@ -27,7 +27,9 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.EnumSet;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -38,8 +40,15 @@ import java.util.SortedMap;
 import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.TreeSet;
+import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
+import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
 
 import javax.management.MBeanException;
 import javax.management.ReflectionException;
@@ -64,28 +73,18 @@ public final class GenericUtils {
     /**
      * The complement of {@link String#CASE_INSENSITIVE_ORDER}
      */
-    public static final Comparator<String> CASE_SENSITIVE_ORDER = new Comparator<String>() {
-        @Override
-        public int compare(String s1, String s2) {
-            if (s1 == s2) {
-                return 0;
-            } else {
-                return s1.compareTo(s2);
-            }
+    public static final Comparator<String> CASE_SENSITIVE_ORDER = (s1, s2) -> {
+        if (s1 == s2) {
+            return 0;
+        } else {
+            return s1.compareTo(s2);
         }
     };
 
     public static final String QUOTES = "\"'";
 
     @SuppressWarnings("rawtypes")
-    private static final Factory CASE_INSENSITIVE_MAP_FACTORY = new Factory() {
-        @Override
-        @SuppressWarnings("unchecked")
-        public Object create() {
-            return new TreeMap(String.CASE_INSENSITIVE_ORDER);
-        }
-
-    };
+    private static final Factory CASE_INSENSITIVE_MAP_FACTORY = () -> new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
 
     private GenericUtils() {
         throw new UnsupportedOperationException("No instance");
@@ -121,6 +120,10 @@ public final class GenericUtils {
         return length(cs) <= 0;
     }
 
+    public static boolean isNotEmpty(CharSequence cs) {
+        return !isEmpty(cs);
+    }
+
     // a List would be better, but we want to be compatible with String.split(...)
     public static String[] split(String s, char ch) {
         if (isEmpty(s)) {
@@ -217,6 +220,10 @@ public final class GenericUtils {
         return (c == null) || c.isEmpty();
     }
 
+    public static boolean isNotEmpty(Collection<?> c) {
+        return !isEmpty(c);
+    }
+
     public static int size(Map<?, ?> m) {
         return m == null ? 0 : m.size();
     }
@@ -225,6 +232,10 @@ public final class GenericUtils {
         return (m == null) || m.isEmpty();
     }
 
+    public static boolean isNotEmpty(Map<?, ?> m) {
+        return !isEmpty(m);
+    }
+
     @SafeVarargs
     public static <T> int length(T... a) {
         return a == null ? 0 : a.length;
@@ -240,10 +251,18 @@ public final class GenericUtils {
         }
     }
 
+    public static<T> boolean isNotEmpty(Iterable<? extends T> iter) {
+        return !isEmpty(iter);
+    }
+
     public static <T> boolean isEmpty(Iterator<? extends T> iter) {
         return iter == null || !iter.hasNext();
     }
 
+    public static <T> boolean isNotEmpty(Iterator<? extends T> iter) {
+        return !isEmpty(iter);
+    }
+
     @SafeVarargs
     public static <T> boolean isEmpty(T... a) {
         return length(a) <= 0;
@@ -275,6 +294,58 @@ public final class GenericUtils {
         return result;
     }
 
+    public static <T> void forEach(Iterable<T> values, Consumer<T> consumer) {
+        if (isNotEmpty(values)) {
+            values.forEach(consumer);
+        }
+    }
+
+    public static <T, U> List<U> map(Collection<T> values, Function<? super T, ? extends U> mapper) {
+        return stream(values).map(mapper).collect(Collectors.toList());
+    }
+
+    public static <T, U> SortedSet<U> mapSort(Collection<T> values,
+                                              Function<? super T, ? extends U> mapper,
+                                              Comparator<U> comparator) {
+        return stream(values).map(mapper).collect(toSortedSet(comparator));
+    }
+
+    public static <T, K, U> SortedMap<K, U> toSortedMap(
+                                Iterable<T> values,
+                                Function<? super T, ? extends K> keyMapper,
+                                Function<? super T, ? extends U> valueMapper,
+                                Comparator<K> comparator) {
+        return stream(values).collect(toSortedMap(keyMapper, valueMapper, comparator));
+    }
+
+    public static <T, K, U> Collector<T, ?, SortedMap<K, U>> toSortedMap(
+                                Function<? super T, ? extends K> keyMapper,
+                                Function<? super T, ? extends U> valueMapper,
+                                Comparator<K> comparator) {
+        return Collectors.toMap(keyMapper, valueMapper, throwingMerger(), () -> new TreeMap<>(comparator));
+    }
+
+    private static <T> BinaryOperator<T> throwingMerger() {
+        return (u, v) -> {
+            throw new IllegalStateException(String.format("Duplicate key %s", u));
+        };
+    }
+
+    public static <T>
+    Collector<T, ?, SortedSet<T>> toSortedSet(Comparator<T> comparator) {
+        return Collectors.toCollection(() -> new TreeSet<>(comparator));
+    }
+
+    public static <T> Stream<T> stream(Iterable<T> values) {
+        if (isEmpty(values)) {
+            return Stream.empty();
+        } else if (values instanceof Collection) {
+            return ((Collection<T>) values).stream();
+        } else {
+            return StreamSupport.stream(values.spliterator(), false);
+        }
+    }
+
     @SafeVarargs
     public static <T> List<T> unmodifiableList(T ... values) {
         return unmodifiableList(asList(values));
@@ -284,22 +355,31 @@ public final class GenericUtils {
         if (isEmpty(values)) {
             return Collections.emptyList();
         } else {
-            return Collections.unmodifiableList(new ArrayList<T>(values));
+            return Collections.unmodifiableList(new ArrayList<>(values));
         }
     }
 
+    public static <T> List<T> unmodifiableList(Stream<T> values) {
+        return unmodifiableList(values.collect(Collectors.toList()));
+    }
+
     @SafeVarargs
     public static <T> List<T> asList(T ... values) {
-        int len = length(values);
-        if (len <= 0) {
-            return Collections.emptyList();
-        } else {
-            return Arrays.asList(values);
-        }
+        return isEmpty(values) ? Collections.emptyList() : Arrays.asList(values);
+    }
+
+    @SafeVarargs
+    public static <T> Set<T> asSet(T ... values) {
+        return new HashSet<>(asList(values));
+    }
+
+    @SafeVarargs
+    public static <V extends Comparable<V>> SortedSet<V> asSortedSet(V ... values) {
+        return asSortedSet(Comparator.naturalOrder(), values);
     }
 
     public static <V extends Comparable<V>> SortedSet<V> asSortedSet(Collection<? extends V> values) {
-        return asSortedSet(Comparator.<V>naturalOrder(), values);
+        return asSortedSet(Comparator.naturalOrder(), values);
     }
 
     /**
@@ -372,7 +452,7 @@ public final class GenericUtils {
      * that 2 (or more) values are not mapped to the same key
      */
     public static <K, V> Map<K, V> mapValues(
-            Transformer<? super V, ? extends K> keyMapper, Factory<? extends Map<K, V>> mapCreator, Collection<? extends V> values) {
+            Transformer<? super V, ? extends K> keyMapper, Factory<? extends Map<K, V>> mapCreator, Collection<V> values) {
         if (isEmpty(values)) {
             return Collections.emptyMap();
         }
@@ -411,18 +491,9 @@ public final class GenericUtils {
      * @return A {@link List} of all the values that were accepted by the predicate
      */
     public static <T> List<T> selectMatchingMembers(Predicate<? super T> acceptor, Collection<? extends T> values) {
-        if (isEmpty(values)) {
-            return Collections.emptyList();
-        }
-
-        List<T> matches = new ArrayList<>(values.size());
-        for (T v : values) {
-            if (acceptor.test(v)) {
-                matches.add(v);
-            }
-        }
-
-        return matches;
+        return GenericUtils.stream(values)
+                .filter(acceptor::test)
+                .collect(Collectors.toList());
     }
 
     /**
@@ -597,6 +668,24 @@ public final class GenericUtils {
         return (iter == null) ? Collections.emptyIterator() : iter;
     }
 
+    public static <U, V> Iterable<V> wrapIterable(Iterable<? extends U> iter, Function<U, V> mapper) {
+        return () -> wrapIterator(iteratorOf(iter), mapper);
+    }
+
+    public static <U, V> Iterator<V> wrapIterator(Iterator<? extends U> iter, Function<U, V> mapper) {
+        final Iterator<? extends U> iterator = iteratorOf(iter);
+        return new Iterator<V>() {
+            @Override
+            public boolean hasNext() {
+                return iterator.hasNext();
+            }
+            @Override
+            public V next() {
+                return mapper.apply(iterator.next());
+            }
+        };
+    }
+
     /**
      * Wraps a group of {@link Supplier}s of {@link Iterable} instances into a &quot;unified&quot;
      * {@link Iterable} of their values, in the same order as the suppliers - i.e., once the values
@@ -608,50 +697,71 @@ public final class GenericUtils {
      * @return The wrapping instance
      */
     public static <T> Iterable<T> multiIterableSuppliers(final Iterable<? extends Supplier<? extends Iterable<? extends T>>> providers) {
-        return (providers == null) ? Collections.emptyList() : new Iterable<T>() {
+        return (providers == null) ? Collections.emptyList() : () -> new Iterator<T>() {
+            private final Iterator<? extends Supplier<? extends Iterable<? extends T>>> iter = iteratorOf(providers);
+            private Iterator<? extends T> current = nextIterator();
+
             @Override
-            public Iterator<T> iterator() {
-                return new Iterator<T>() {
-                    private final Iterator<? extends Supplier<? extends Iterable<? extends T>>> iter = iteratorOf(providers);
-                    private Iterator<? extends T> current = nextIterator();
-
-                    @Override
-                    public boolean hasNext() {
-                        return current != null;
-                    }
+            public boolean hasNext() {
+                return current != null;
+            }
 
-                    @Override
-                    public T next() {
-                        if (current == null) {
-                            throw new NoSuchElementException("No more elements");
-                        }
+            @Override
+            public T next() {
+                if (current == null) {
+                    throw new NoSuchElementException("No more elements");
+                }
 
-                        T value = current.next();
-                        if (!current.hasNext()) {
-                            current = nextIterator();
-                        }
+                T value = current.next();
+                if (!current.hasNext()) {
+                    current = nextIterator();
+                }
 
-                        return value;
-                    }
+                return value;
+            }
 
-                    @Override
-                    public void remove() {
-                        throw new UnsupportedOperationException("remove");
+            private Iterator<? extends T> nextIterator() {
+                while (iter.hasNext()) {
+                    Supplier<? extends Iterable<? extends T>> supplier = iter.next();
+                    Iterator<? extends T> values = iteratorOf((supplier == null) ? null : supplier.get());
+                    if (values.hasNext()) {
+                        return values;
                     }
+                }
 
-                    private Iterator<? extends T> nextIterator() {
-                        while (iter.hasNext()) {
-                            Supplier<? extends Iterable<? extends T>> supplier = iter.next();
-                            Iterator<? extends T> values = iteratorOf((supplier == null) ? null : supplier.get());
-                            if (values.hasNext()) {
-                                return values;
-                            }
-                        }
-
-                        return null;
-                    }
-                };
+                return null;
             }
         };
     }
+
+    public static <K, V> MapBuilder<K, V> mapBuilder() {
+        return new MapBuilder<>();
+    }
+
+    public static <K, V> MapBuilder<K, V> mapBuilder(Comparator<K> comparator) {
+        return new MapBuilder<>(comparator);
+    }
+
+    public static class MapBuilder<K, V> {
+        private Map<K, V> map;
+
+        public MapBuilder() {
+            this.map = new LinkedHashMap<>();
+        }
+
+        public MapBuilder(Comparator<K> comparator) {
+            this.map = new TreeMap<>(comparator);
+        }
+
+        public MapBuilder<K, V> put(K k, V v) {
+            map.put(k, v);
+            return this;
+        }
+        public Map<K, V> build() {
+            return map;
+        }
+        public Map<K, V> immutable() {
+            return Collections.unmodifiableMap(map);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java b/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java
index cedb963..ea2962e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java
@@ -28,12 +28,7 @@ public interface Int2IntFunction {
     /**
      * An {@link Int2IntFunction} that returns same value as input
      */
-    Int2IntFunction IDENTITY = new Int2IntFunction() {
-        @Override
-        public int apply(int value) {
-            return value;
-        }
-    };
+    Int2IntFunction IDENTITY = value -> value;
 
     /**
      * @param value Argument
@@ -42,6 +37,7 @@ public interface Int2IntFunction {
     int apply(int value);
 
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
 
@@ -50,47 +46,48 @@ public interface Int2IntFunction {
         }
 
         public static Int2IntFunction sub(int delta) {
-            return add(0 - delta);
+            return Int2IntFunction.sub(delta);
         }
 
         public static Int2IntFunction add(final int delta) {
-            if (delta == 0) {
-                return IDENTITY;
-            } else {
-                return new Int2IntFunction() {
-                    @Override
-                    public int apply(int value) {
-                        return value + delta;
-                    }
-                };
-            }
+            return Int2IntFunction.add(delta);
         }
 
         public static Int2IntFunction mul(final int factor) {
-            if (factor == 1) {
-                return IDENTITY;
-            } else {
-                return new Int2IntFunction() {
-                    @Override
-                    public int apply(int value) {
-                        return value * factor;
-                    }
-                };
-            }
+            return Int2IntFunction.mul(factor);
         }
 
         public static Int2IntFunction div(final int factor) {
-            if (factor == 1) {
-                return IDENTITY;
-            } else {
-                ValidateUtils.checkTrue(factor != 0, "Zero division factor");
-                return new Int2IntFunction() {
-                    @Override
-                    public int apply(int value) {
-                        return value / factor;
-                    }
-                };
-            }
+            return Int2IntFunction.div(factor);
+        }
+    }
+
+    static Int2IntFunction sub(int delta) {
+        return add(0 - delta);
+    }
+
+    static Int2IntFunction add(final int delta) {
+        if (delta == 0) {
+            return IDENTITY;
+        } else {
+            return value -> value + delta;
+        }
+    }
+
+    static Int2IntFunction mul(final int factor) {
+        if (factor == 1) {
+            return IDENTITY;
+        } else {
+            return value -> value * factor;
+        }
+    }
+
+    static Int2IntFunction div(final int factor) {
+        if (factor == 1) {
+            return IDENTITY;
+        } else {
+            ValidateUtils.checkTrue(factor != 0, "Zero division factor");
+            return value -> value / factor;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
index 51c321b..b29d4fa 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
@@ -20,9 +20,9 @@
 package org.apache.sshd.common.util;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.stream.IntStream;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
@@ -33,26 +33,18 @@ public final class NumberUtils {
      * primitive numerical values
      */
     public static final List<Class<?>> NUMERIC_PRIMITIVE_CLASSES =
-            Collections.unmodifiableList(Arrays.<Class<?>>asList(
+            GenericUtils.unmodifiableList(
                         Byte.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE,
                         Float.TYPE, Double.TYPE
-                    ));
+                    );
 
     /**
      * A {@link List} containing all the pure powers of 2 for a {@code long}
      * value. The value at index <I>n</I> is 2 to the power of <I>n</I>
      */
     public static final List<Long> POWERS_OF_TWO =
-            Collections.unmodifiableList(new ArrayList<Long>(Long.SIZE) {
-                private static final long serialVersionUID = 1L;    // we're not serializing it
-
-                {
-                    long value = 1L;
-                    for (int power = 0; power < Long.SIZE; power++, value <<= 1) {
-                        add(value);
-                    }
-                }
-            });
+            GenericUtils.unmodifiableList(IntStream.range(0, 64)
+                    .mapToObj(i -> 1L << i));
 
     private NumberUtils() {
         throw new UnsupportedOperationException("No instance");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/Pair.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/Pair.java b/sshd-core/src/main/java/org/apache/sshd/common/util/Pair.java
index 8a9bbd8..5cb56d5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/Pair.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/Pair.java
@@ -20,7 +20,6 @@ package org.apache.sshd.common.util;
 
 import java.util.Comparator;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Objects;
 
 /**
@@ -31,16 +30,11 @@ import java.util.Objects;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public class Pair<F, S> implements Map.Entry<F, S> {
-    @SuppressWarnings("rawtypes")
-    private static final Comparator<Map.Entry<Comparable, ?>> BY_KEY_COMPARATOR =
-        new Comparator<Map.Entry<Comparable, ?>>() {
-            @SuppressWarnings("unchecked")
-            @Override
-            public int compare(Entry<Comparable, ?> o1, Entry<Comparable, ?> o2) {
-                Comparable k1 = o1.getKey();
-                Comparable k2 = o2.getKey();
-                return k1.compareTo(k2);
-            }
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private static final Comparator<Map.Entry<Comparable, ?>> BY_KEY_COMPARATOR = (o1, o2) -> {
+        Comparable k1 = o1.getKey();
+        Comparable k2 = o2.getKey();
+        return k1.compareTo(k2);
     };
 
     private final F first;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/ReflectionUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/ReflectionUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/ReflectionUtils.java
index 961f32a..f8e1d6c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/ReflectionUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/ReflectionUtils.java
@@ -27,12 +27,7 @@ import java.util.function.Predicate;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public final class ReflectionUtils {
-    public static final Transformer<Field, String> FIELD_NAME_EXTRACTOR = new Transformer<Field, String>() {
-        @Override
-        public String transform(Field f) {
-            return (f == null) ? null : f.getName();
-        }
-    };
+    public static final Transformer<Field, String> FIELD_NAME_EXTRACTOR = f -> (f == null) ? null : f.getName();
 
     private ReflectionUtils() {
         throw new UnsupportedOperationException("No instance");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
index a02d553..cb8ed8e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
@@ -371,8 +371,8 @@ public final class SelectorUtils {
         char ch;
 
         boolean containsStar = false;
-        for (int i = 0; i < patArr.length; i++) {
-            if (patArr[i] == '*') {
+        for (char aPatArr : patArr) {
+            if (aPatArr == '*') {
                 containsStar = true;
                 break;
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java b/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java
index d353f8d..2d025b8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java
@@ -33,24 +33,16 @@ public interface Transformer<I, O> extends Function<I, O> {
      * Invokes {@link Objects#toString(Object, String)} on the argument
      * with {@code null} as the value to return if argument is {@code null}
      */
-    Transformer<Object, String> TOSTRING = new Transformer<Object, String>() {
-        @Override
-        public String transform(Object input) {
-            return Objects.toString(input, null);
-        }
-    };
+    Transformer<Object, String> TOSTRING = input -> Objects.toString(input, null);
 
     /**
      * Returns {@link Enum#name()} or {@code null} if argument is {@code null}
      */
-    Transformer<Enum<?>, String> ENUM_NAME_EXTRACTOR = new Transformer<Enum<?>, String>() {
-        @Override
-        public String transform(Enum<?> input) {
-            if (input == null) {
-                return null;
-            } else {
-                return input.name();
-            }
+    Transformer<Enum<?>, String> ENUM_NAME_EXTRACTOR = input -> {
+        if (input == null) {
+            return null;
+        } else {
+            return input.name();
         }
     };
 
@@ -65,24 +57,21 @@ public interface Transformer<I, O> extends Function<I, O> {
     O transform(I input);
 
     // CHECKSTYLE:OFF
+    @Deprecated
     final class Utils {
     // CHECKSTYLE:ON
 
-        @SuppressWarnings("rawtypes")
-        private static final Transformer IDENTITY = new Transformer() {
-            @Override
-            public Object transform(Object input) {
-                return input;
-            }
-        };
-
         private Utils() {
             throw new UnsupportedOperationException("No instance allowed");
         }
 
-        @SuppressWarnings({ "unchecked" })
         public static <U extends V, V> Transformer<U, V> identity() {
-            return IDENTITY;
+            return Transformer.identity();
         }
     }
+
+    static <U extends V, V> Transformer<U, V> identity() {
+        return input -> input;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/977b7b52/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java
index 3679471..d725dea 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java
@@ -80,6 +80,12 @@ public final class ValidateUtils {
         return t;
     }
 
+    public static <T, C extends Iterable<T>> C checkNotNullAndNotEmpty(C t, String message, Object... args) {
+        t = checkNotNull(t, message, args);
+        checkTrue(GenericUtils.isNotEmpty(t), message, args);
+        return t;
+    }
+
     public static byte[] checkNotNullAndNotEmpty(byte[] a, String message) {
         a = checkNotNull(a, message);
         checkTrue(NumberUtils.length(a) > 0, message);


[02/16] mina-sshd git commit: [SSHD-698] Code cleanup

Posted by gn...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java
index 7299a3c..51b31f6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java
@@ -78,6 +78,6 @@ public class VersionsParser extends AbstractParser<Versions> {
 
     public Versions parse(String value) {
         String[] comps = GenericUtils.split(value, Versions.SEP);
-        return new Versions(GenericUtils.isEmpty(comps) ? Collections.<String>emptyList() : Arrays.asList(comps));
+        return new Versions(GenericUtils.isEmpty(comps) ? Collections.emptyList() : Arrays.asList(comps));
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
index 51f7dd5..72b16b9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
@@ -104,7 +104,7 @@ public final class EventListenerUtils {
      * instance is actually contained
      */
     public static <L extends EventListener> Set<L> synchronizedListenersSet(Collection<? extends L> listeners) {
-        Set<L> s = EventListenerUtils.<L>synchronizedListenersSet();
+        Set<L> s = EventListenerUtils.synchronizedListenersSet();
         if (GenericUtils.size(listeners) > 0) {
             s.addAll(listeners);
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
index 5516e44..ba58385 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
@@ -251,7 +251,7 @@ public final class GenericUtils {
 
     @SafeVarargs    // there is no EnumSet.of(...) so we have to provide our own
     public static <E extends Enum<E>> Set<E> of(E... values) {
-        return of(isEmpty(values) ? Collections.<E>emptySet() : Arrays.asList(values));
+        return of(isEmpty(values) ? Collections.emptySet() : Arrays.asList(values));
     }
 
     public static <E extends Enum<E>> Set<E> of(Collection<? extends E> values) {
@@ -311,7 +311,7 @@ public final class GenericUtils {
      */
     @SafeVarargs
     public static <V> SortedSet<V> asSortedSet(Comparator<? super V> comp, V ... values) {
-        return asSortedSet(comp, isEmpty(values) ? Collections.<V>emptyList() : Arrays.asList(values));
+        return asSortedSet(comp, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
     }
 
     /**
@@ -355,7 +355,7 @@ public final class GenericUtils {
     @SafeVarargs
     public static <K, V> Map<K, V> mapValues(
             Transformer<? super V, ? extends K> keyMapper, Factory<? extends Map<K, V>> mapCreator, V ... values) {
-        return mapValues(keyMapper, mapCreator, isEmpty(values) ? Collections.<V>emptyList() : Arrays.asList(values));
+        return mapValues(keyMapper, mapCreator, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
     }
 
     /**
@@ -399,7 +399,7 @@ public final class GenericUtils {
      */
     @SafeVarargs
     public static <T> List<T> selectMatchingMembers(Predicate<? super T> acceptor, T ... values) {
-        return selectMatchingMembers(acceptor, isEmpty(values) ? Collections.<T>emptyList() : Arrays.asList(values));
+        return selectMatchingMembers(acceptor, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
     }
 
     /**
@@ -594,7 +594,7 @@ public final class GenericUtils {
      * @see Collections#emptyIterator()
      */
     public static <T> Iterator<T> iteratorOf(Iterator<T> iter) {
-        return (iter == null) ? Collections.<T>emptyIterator() : iter;
+        return (iter == null) ? Collections.emptyIterator() : iter;
     }
 
     /**
@@ -608,7 +608,7 @@ public final class GenericUtils {
      * @return The wrapping instance
      */
     public static <T> Iterable<T> multiIterableSuppliers(final Iterable<? extends Supplier<? extends Iterable<? extends T>>> providers) {
-        return (providers == null) ? Collections.<T>emptyList() : new Iterable<T>() {
+        return (providers == null) ? Collections.emptyList() : new Iterable<T>() {
             @Override
             public Iterator<T> iterator() {
                 return new Iterator<T>() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
index 854b554..d34323c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
@@ -149,14 +149,7 @@ public final class SelectorUtils {
         if (strIdxStart > strIdxEnd) {
             // String is exhausted
             return true;
-        } else if (patIdxStart > patIdxEnd) {
-            // String not exhausted, but pattern is. Failure.
-            return false;
-        } else {
-            // pattern now holds ** while string is not exhausted
-            // this will generate false positives but we can live with that.
-            return true;
-        }
+        } else return patIdxStart <= patIdxEnd;
         // CHECKSTYLE:ON
     }
 
@@ -850,10 +843,7 @@ public final class SelectorUtils {
         if (!target.exists()) {
             return true;
         }
-        if ((src.lastModified() - granularity) > target.lastModified()) {
-            return true;
-        }
-        return false;
+        return (src.lastModified() - granularity) > target.lastModified();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
index 40a238b..247e7ef 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
@@ -41,7 +41,7 @@ public abstract class AbstractBufferPublicKeyParser<PUB extends PublicKey> imple
     private final Collection<String> supported;
 
     protected AbstractBufferPublicKeyParser(Class<PUB> keyClass, String ... supported) {
-        this(keyClass, GenericUtils.isEmpty(supported) ? Collections.<String>emptyList() : Arrays.asList(supported));
+        this(keyClass, GenericUtils.isEmpty(supported) ? Collections.emptyList() : Arrays.asList(supported));
     }
 
     protected AbstractBufferPublicKeyParser(Class<PUB> keyClass, Collection<String> supported) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
index 265e740..3b6188f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
@@ -36,7 +36,7 @@ public class FuturesCloseable<T extends SshFuture> extends SimpleCloseable {
 
     public FuturesCloseable(Object lock, Iterable<? extends SshFuture<T>> futures) {
         super(lock);
-        this.futures = (futures == null) ? Collections.<SshFuture<T>>emptyList() : futures;
+        this.futures = (futures == null) ? Collections.emptyList() : futures;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
index e611206..a009ed8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
@@ -37,7 +37,7 @@ public class ParallelCloseable extends SimpleCloseable {
 
     public ParallelCloseable(Object lock, Iterable<? extends Closeable> closeables) {
         super(lock);
-        this.closeables = (closeables == null) ? Collections.<Closeable>emptyList() : closeables;
+        this.closeables = (closeables == null) ? Collections.emptyList() : closeables;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java
index 3a91831..f63ac91 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java
@@ -37,7 +37,7 @@ public class SequentialCloseable extends SimpleCloseable {
 
     public SequentialCloseable(Object lock, Iterable<? extends Closeable> closeables) {
         super(lock);
-        this.closeables = (closeables == null) ? Collections.<Closeable>emptyList() : closeables;
+        this.closeables = (closeables == null) ? Collections.emptyList() : closeables;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
index d51b7f6..ebca9f2 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
@@ -144,11 +144,8 @@ public class ModifiableFileWatcher extends AbstractLoggingBean {
         }
 
         long timestamp = modifiedTime.toMillis();
-        if (timestamp != lastModified.getAndSet(timestamp)) {
-            return true;
-        }
+        return timestamp != lastModified.getAndSet(timestamp);
 
-        return false;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java b/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
index 9a2778d..65252a0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
@@ -225,11 +225,8 @@ public class SshdSocketAddress extends SocketAddress {
             return false;
         }
 
-        if (isLoopback(addr)) {
-            return false;
-        }
+        return !isLoopback(addr);
 
-        return true;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
index e19c680..06b970e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
@@ -161,7 +161,7 @@ public interface ServerAuthenticationManager {
         setUserAuthFactoriesNames(GenericUtils.split(names, ','));
     }
     default void setUserAuthFactoriesNames(String ... names) {
-        setUserAuthFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.<String>emptyList() : Arrays.asList(names));
+        setUserAuthFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setUserAuthFactoriesNames(Collection<String> names) {
         BuiltinUserAuthFactories.ParseResult result = BuiltinUserAuthFactories.parseFactoriesList(names);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
index b60fabd..a9c836a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
@@ -601,7 +601,7 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
                 return new ProcessShellFactory(GenericUtils.split(command, ' ')).create();
             }
         }).build());
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+        sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
         sshd.start();
 
         Thread.sleep(Long.MAX_VALUE);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java b/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java
index 0b4adeb..22206c4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java
@@ -140,7 +140,7 @@ public class StandardEnvironment extends AbstractLoggingBean implements Environm
             synchronized (listeners) {
                 ls = listeners.get(signal);
                 if (ls == null) {
-                    ls =  EventListenerUtils.<SignalListener>synchronizedListenersSet();
+                    ls =  EventListenerUtils.synchronizedListenersSet();
                     listeners.put(signal, ls);
                 }
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
index 05c395b..4e69543 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
@@ -93,7 +93,7 @@ public enum BuiltinUserAuthFactories implements NamedFactory<UserAuthFactory> {
     }
 
     public static ParseResult parseFactoriesList(String... factories) {
-        return parseFactoriesList(GenericUtils.isEmpty((Object[]) factories) ? Collections.<String>emptyList() : Arrays.asList(factories));
+        return parseFactoriesList(GenericUtils.isEmpty((Object[]) factories) ? Collections.emptyList() : Arrays.asList(factories));
     }
 
     public static ParseResult parseFactoriesList(Collection<String> factories) {
@@ -133,7 +133,7 @@ public enum BuiltinUserAuthFactories implements NamedFactory<UserAuthFactory> {
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
      */
     public static class ParseResult extends NamedFactoriesListParseResult<UserAuth, UserAuthFactory> {
-        public static final ParseResult EMPTY = new ParseResult(Collections.<UserAuthFactory>emptyList(), Collections.<String>emptyList());
+        public static final ParseResult EMPTY = new ParseResult(Collections.emptyList(), Collections.emptyList());
 
         public ParseResult(List<UserAuthFactory> parsed, List<String> unsupported) {
             super(parsed, unsupported);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
index 2921437..2f501c3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
@@ -83,7 +83,7 @@ public class UserAuthHostBased extends AbstractUserAuth implements SignatureFact
 
         Buffer buf = new ByteArrayBuffer(buffer.array(), keyOffset, keyLen, true);
         PublicKey clientKey = buf.getRawPublicKey();
-        List<X509Certificate> certs = Collections.<X509Certificate>emptyList();
+        List<X509Certificate> certs = Collections.emptyList();
         if (buf.available() > 0) {
             CertificateFactory cf = SecurityUtils.getCertificateFactory("X.509");
             certs = new ArrayList<>();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
index 16f7e5d..9177966 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
@@ -97,7 +97,7 @@ public class UserAuthKeyboardInteractive extends AbstractUserAuth {
             }
 
             int num = buffer.getInt();
-            List<String> responses = (num <= 0) ? Collections.<String>emptyList() : new ArrayList<String>(num);
+            List<String> responses = (num <= 0) ? Collections.emptyList() : new ArrayList<String>(num);
             for (int index = 0; index < num; index++) {
                 String value = buffer.getString();
                 if (log.isTraceEnabled()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java
index 6cb844a..fcba948 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java
@@ -34,7 +34,7 @@ public class KeySetPublickeyAuthenticator extends AbstractLoggingBean implements
     private final Collection<? extends PublicKey> keySet;
 
     public KeySetPublickeyAuthenticator(Collection<? extends PublicKey> keySet) {
-        this.keySet = (keySet == null) ? Collections.<PublicKey>emptyList() : keySet;
+        this.keySet = (keySet == null) ? Collections.emptyList() : keySet;
     }
 
     public final Collection<? extends PublicKey> getKeySet() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
index 231c43b..835317e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
@@ -48,7 +48,7 @@ public abstract class AbstractServerChannel extends AbstractChannel implements S
     protected final AtomicBoolean exitStatusSent = new AtomicBoolean(false);
 
     protected AbstractServerChannel() {
-        this(Collections.<RequestHandler<Channel>>emptyList());
+        this(Collections.emptyList());
     }
 
     protected AbstractServerChannel(Collection<? extends RequestHandler<Channel>> handlers) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
index d558d74..e655113 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
@@ -314,7 +314,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
                 ? ThreadUtils.newSingleThreadExecutor("TcpIpServerChannel-ConnectorCleanup[" + getSession() + "]")
                 : service;
         // shutdown the temporary executor service if had to create it
-        final boolean shutdown = (executors == service) ? isShutdownOnExit() : true;
+        final boolean shutdown = executors != service || isShutdownOnExit();
         executors.submit(new Runnable() {
             @SuppressWarnings("synthetic-access")
             @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
index 0961e1d..d53b666 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
@@ -107,7 +107,7 @@ public class ScpCommandFactory implements ScpFileOpenerHolder, CommandFactory, C
     private int sendBufferSize = ScpHelper.MIN_SEND_BUFFER_SIZE;
     private int receiveBufferSize = ScpHelper.MIN_RECEIVE_BUFFER_SIZE;
     private Collection<ScpTransferEventListener> listeners =
-            EventListenerUtils.<ScpTransferEventListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     private ScpTransferEventListener listenerProxy;
 
     public ScpCommandFactory() {
@@ -258,7 +258,7 @@ public class ScpCommandFactory implements ScpFileOpenerHolder, CommandFactory, C
         try {
             ScpCommandFactory other = getClass().cast(super.clone());
             // clone the listeners set as well
-            other.listeners = EventListenerUtils.<ScpTransferEventListener>synchronizedListenersSet(this.listeners);
+            other.listeners = EventListenerUtils.synchronizedListenersSet(this.listeners);
             other.listenerProxy = EventListenerUtils.proxyWrapper(ScpTransferEventListener.class, getClass().getClassLoader(), other.listeners);
             return other;
         } catch (CloneNotSupportedException e) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
index 189dae1..0cee65f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
@@ -113,7 +113,7 @@ public class InvertedShellWrapper extends AbstractLoggingBean implements Command
         this.executor = (executor == null) ? ThreadUtils.newSingleThreadExecutor("shell[0x" + Integer.toHexString(shell.hashCode()) + "]") : executor;
         ValidateUtils.checkTrue(bufferSize > Byte.SIZE, "Copy buffer size too small: %d", bufferSize);
         this.bufferSize = bufferSize;
-        this.shutdownExecutor = (executor == null) ? true : shutdownExecutor;
+        this.shutdownExecutor = (executor == null) || shutdownExecutor;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
index 755f390..a74de9b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
@@ -57,7 +57,7 @@ public class ProcessShell extends AbstractLoggingBean implements InvertedShell,
      *                   create the full command to be executed by the shell
      */
     public ProcessShell(String ... command) {
-        this(GenericUtils.isEmpty(command) ? Collections.<String>emptyList() : Arrays.asList(command));
+        this(GenericUtils.isEmpty(command) ? Collections.emptyList() : Arrays.asList(command));
     }
 
     public ProcessShell(Collection<String> command) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
index cfadb50..44b3caf 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
@@ -38,11 +38,11 @@ public class ProcessShellFactory extends AbstractLoggingBean implements Factory<
     private List<String> command;
 
     public ProcessShellFactory() {
-        this(Collections.<String>emptyList());
+        this(Collections.emptyList());
     }
 
     public ProcessShellFactory(String ... command) {
-        this(GenericUtils.isEmpty(command) ? Collections.<String>emptyList() : Arrays.asList(command));
+        this(GenericUtils.isEmpty(command) ? Collections.emptyList() : Arrays.asList(command));
     }
 
     public ProcessShellFactory(List<String> command) {
@@ -54,7 +54,7 @@ public class ProcessShellFactory extends AbstractLoggingBean implements Factory<
     }
 
     public void setCommand(String ... command) {
-        setCommand(GenericUtils.isEmpty(command) ? Collections.<String>emptyList() : Arrays.asList(command));
+        setCommand(GenericUtils.isEmpty(command) ? Collections.emptyList() : Arrays.asList(command));
     }
 
     public void setCommand(List<String> command) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java
index aa2c01c..91bbaf1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java
@@ -29,7 +29,7 @@ import org.apache.sshd.common.util.ValidateUtils;
  */
 public abstract class AbstractSftpEventListenerManager implements SftpEventListenerManager {
     private final Collection<SftpEventListener> sftpEventListeners =
-            EventListenerUtils.<SftpEventListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     private final SftpEventListener sftpEventListenerProxy;
 
     protected AbstractSftpEventListenerManager() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
index 4aa4020..71d4379 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
@@ -303,7 +303,7 @@ public class SftpSubsystem
     private ServerSession serverSession;
     private final AtomicBoolean closed = new AtomicBoolean(false);
     private final Collection<SftpEventListener> sftpEventListeners =
-            EventListenerUtils.<SftpEventListener>synchronizedListenersSet();
+            EventListenerUtils.synchronizedListenersSet();
     private final SftpEventListener sftpEventListenerProxy;
 
     /**
@@ -1502,8 +1502,8 @@ public class SftpSubsystem
 
         doCopyFile(id, srcFile, dstFile,
                 overwriteDestination
-                        ? Collections.<CopyOption>singletonList(StandardCopyOption.REPLACE_EXISTING)
-                        : Collections.<CopyOption>emptyList());
+                        ? Collections.singletonList(StandardCopyOption.REPLACE_EXISTING)
+                        : Collections.emptyList());
     }
 
     protected void doCopyFile(int id, String srcFile, String dstFile, Collection<CopyOption> opts) throws IOException {
@@ -1549,7 +1549,7 @@ public class SftpSubsystem
             path = ".";
         }
 
-        Map<String, ?> attrs = Collections.<String, Object>emptyMap();
+        Map<String, ?> attrs = Collections.emptyMap();
         Pair<Path, Boolean> result;
         try {
             LinkOption[] options = IoUtils.getLinkOptions(false);
@@ -2298,7 +2298,7 @@ public class SftpSubsystem
 
         Map<String, OptionalFeature> extensions = getSupportedClientExtensions();
         int numExtensions = GenericUtils.size(extensions);
-        List<String> extras = (numExtensions <= 0) ? Collections.<String>emptyList() : new ArrayList<>(numExtensions);
+        List<String> extras = (numExtensions <= 0) ? Collections.emptyList() : new ArrayList<>(numExtensions);
         if (numExtensions > 0) {
             for (Map.Entry<String, OptionalFeature> ee : extensions.entrySet()) {
                 String name = ee.getKey();
@@ -2637,7 +2637,7 @@ public class SftpSubsystem
          *      The server will respond with a SSH_FXP_NAME packet containing only
          *      one name and a dummy attributes value.
          */
-        Map<String, Object> attrs = Collections.<String, Object>emptyMap();
+        Map<String, Object> attrs = Collections.emptyMap();
         if (version == SftpConstants.SFTP_V3) {
             buffer.putString(SftpHelper.getLongName(normalizedPath, attrs));
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/LoadTest.java b/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
index d27e6c9..2e5566f 100644
--- a/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
@@ -35,11 +35,9 @@ import org.apache.sshd.client.channel.ClientChannel;
 import org.apache.sshd.client.channel.ClientChannelEvent;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.channel.Channel;
 import org.apache.sshd.common.cipher.BuiltinCiphers;
-import org.apache.sshd.common.cipher.Cipher;
 import org.apache.sshd.common.kex.BuiltinDHFactories;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.util.test.BaseTestSupport;
@@ -127,7 +125,7 @@ public class LoadTest extends BaseTestSupport {
             PropertyResolverUtils.updateProperty(client, FactoryManager.WINDOW_SIZE, 1024 * 8);
             client.setKeyExchangeFactories(Arrays.asList(
                     ClientBuilder.DH2KEX.transform(BuiltinDHFactories.dhg1)));
-            client.setCipherFactories(Arrays.<NamedFactory<Cipher>>asList(BuiltinCiphers.blowfishcbc));
+            client.setCipherFactories(Arrays.asList(BuiltinCiphers.blowfishcbc));
             client.start();
             try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
                 session.addPasswordIdentity(getCurrentTestName());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
index 28d5436..aaab336 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
@@ -48,7 +48,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.sshd.client.auth.UserAuth;
 import org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractive;
 import org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractiveFactory;
 import org.apache.sshd.client.auth.keyboard.UserInteraction;
@@ -67,14 +66,12 @@ import org.apache.sshd.client.subsystem.SubsystemClient;
 import org.apache.sshd.client.subsystem.sftp.SftpClient;
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.NamedResource;
 import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.RuntimeSshException;
 import org.apache.sshd.common.Service;
 import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.SshException;
-import org.apache.sshd.common.channel.AbstractChannel;
 import org.apache.sshd.common.channel.Channel;
 import org.apache.sshd.common.channel.ChannelListener;
 import org.apache.sshd.common.channel.ChannelListenerManager;
@@ -196,7 +193,7 @@ public class ClientTest extends BaseTestSupport {
                 },
                 ServerConnectionServiceFactory.INSTANCE
         ));
-        sshd.setChannelFactories(Arrays.<NamedFactory<Channel>>asList(
+        sshd.setChannelFactories(Arrays.asList(
                 new ChannelSessionFactory() {
                     @Override
                     public Channel create() {
@@ -444,7 +441,7 @@ public class ClientTest extends BaseTestSupport {
                 assertSame("Mismatched closed channel instances", channel, channelHolder.getAndSet(null));
             }
         });
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+        sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
 
         client.start();
 
@@ -958,7 +955,7 @@ public class ClientTest extends BaseTestSupport {
     public void testPublicKeyAuth() throws Exception {
         sshd.setPasswordAuthenticator(RejectAllPasswordAuthenticator.INSTANCE);
         sshd.setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator.NONE);
-        client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthPublicKeyFactory.INSTANCE));
+        client.setUserAuthFactories(Arrays.asList(UserAuthPublicKeyFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -983,7 +980,7 @@ public class ClientTest extends BaseTestSupport {
                 return key.equals(pair.getPublic());
             }
         });
-        client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthPublicKeyFactory.INSTANCE));
+        client.setUserAuthFactories(Arrays.asList(UserAuthPublicKeyFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -999,7 +996,7 @@ public class ClientTest extends BaseTestSupport {
 
     @Test
     public void testPasswordAuthNew() throws Exception {
-        client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthPasswordFactory.INSTANCE));
+        client.setUserAuthFactories(Arrays.asList(UserAuthPasswordFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = createTestClientSession()) {
@@ -1012,7 +1009,7 @@ public class ClientTest extends BaseTestSupport {
 
     @Test
     public void testPasswordAuthNewWithFailureOnFirstIdentity() throws Exception {
-        client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthPasswordFactory.INSTANCE));
+        client.setUserAuthFactories(Arrays.asList(UserAuthPasswordFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1028,7 +1025,7 @@ public class ClientTest extends BaseTestSupport {
 
     @Test
     public void testKeyboardInteractiveAuthNew() throws Exception {
-        client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+        client.setUserAuthFactories(Arrays.asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = createTestClientSession()) {
@@ -1041,7 +1038,7 @@ public class ClientTest extends BaseTestSupport {
 
     @Test
     public void testKeyboardInteractiveAuthNewWithFailureOnFirstIdentity() throws Exception {
-        client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+        client.setUserAuthFactories(Arrays.asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
         client.start();
 
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1058,7 +1055,7 @@ public class ClientTest extends BaseTestSupport {
     @Test   // see SSHD-504
     public void testDefaultKeyboardInteractivePasswordPromptLocationIndependence() throws Exception {
         final Collection<String> mismatchedPrompts = new LinkedList<>();
-        client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(new UserAuthKeyboardInteractiveFactory() {
+        client.setUserAuthFactories(Arrays.asList(new UserAuthKeyboardInteractiveFactory() {
             @Override
             public UserAuthKeyboardInteractive create() {
                 return new UserAuthKeyboardInteractive() {
@@ -1089,7 +1086,7 @@ public class ClientTest extends BaseTestSupport {
             }
         };
         final List<Transformer<String, String>> xformers =
-                Collections.unmodifiableList(Arrays.<Transformer<String, String>>asList(
+                Collections.unmodifiableList(Arrays.asList(
                         new Transformer<String, String>() {  // prefixed
                             @Override
                             public String transform(String input) {
@@ -1153,7 +1150,7 @@ public class ClientTest extends BaseTestSupport {
 
     @Test
     public void testDefaultKeyboardInteractiveWithFailures() throws Exception {
-        client.setUserAuthFactories(Collections.<NamedFactory<UserAuth>>singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+        client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
 
         final AtomicInteger count = new AtomicInteger();
         final AtomicReference<ClientSession> interactionSessionHolder = new AtomicReference<>(null);
@@ -1220,7 +1217,7 @@ public class ClientTest extends BaseTestSupport {
         final int maxPrompts = 3;
         PropertyResolverUtils.updateProperty(client, ClientAuthenticationManager.PASSWORD_PROMPTS, maxPrompts);
 
-        client.setUserAuthFactories(Collections.<NamedFactory<UserAuth>>singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+        client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
         client.start();
 
         try (final ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1271,7 +1268,7 @@ public class ClientTest extends BaseTestSupport {
         final AtomicInteger count = new AtomicInteger();
         final int maxPrompts = 3;
         PropertyResolverUtils.updateProperty(client, ClientAuthenticationManager.PASSWORD_PROMPTS, maxPrompts);
-        client.setUserAuthFactories(Collections.<NamedFactory<UserAuth>>singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+        client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
         client.start();
 
         try (final ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1396,7 +1393,7 @@ public class ClientTest extends BaseTestSupport {
 
             Set<Integer> ids = new HashSet<>(channels.size());
             for (ClientChannel c : channels) {
-                int id = ((AbstractChannel) c).getId();
+                int id = c.getId();
                 assertTrue("Channel ID repeated: " + id, ids.add(Integer.valueOf(id)));
             }
         } finally {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java b/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java
index 1a7e319..4b86ad2 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java
@@ -59,7 +59,7 @@ public class ConfigFileHostEntryResolverTest extends BaseTestSupport {
 
         HostConfigEntry expected = new HostConfigEntry(getCurrentTestName(), getCurrentTestName(), 7365, getCurrentTestName());
         testConfigFileReload("Non-existing", path, reloadCount, null, resolver, expected, null);
-        testConfigFileReload("Empty", path, reloadCount, Collections.<HostConfigEntry>emptyList(), resolver, expected, null);
+        testConfigFileReload("Empty", path, reloadCount, Collections.emptyList(), resolver, expected, null);
         testConfigFileReload("Global", path, reloadCount,
                 Collections.singletonList(new HostConfigEntry(HostPatternsHolder.ALL_HOSTS_PATTERN, expected.getHost(), expected.getPort(), expected.getUsername())),
                 resolver, expected, expected);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java
index bde1cc2..6e037b0 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java
@@ -27,13 +27,11 @@ import java.util.Collections;
 import java.util.EnumSet;
 
 import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.file.FileSystemFactory;
 import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
 import org.apache.sshd.common.util.io.IoUtils;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.scp.ScpCommandFactory;
 import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
 import org.apache.sshd.util.test.Utils;
@@ -59,7 +57,7 @@ public class SimpleSftpClientTest extends BaseSimpleClientTestSupport {
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+        sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
         sshd.setCommandFactory(new ScpCommandFactory());
         sshd.setFileSystemFactory(fileSystemFactory);
         client.start();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
index f2ef1bd..1fb68e0 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
@@ -25,10 +25,8 @@ import java.util.Collections;
 
 import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.subsystem.sftp.extensions.SftpClientExtension;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.file.FileSystemFactory;
 import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.scp.ScpCommandFactory;
 import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
@@ -58,7 +56,7 @@ public abstract class AbstractSftpClientTestSupport extends BaseTestSupport {
     public static void setupClientAndServer() throws Exception {
         JSchLogger.init();
         sshd = Utils.setupTestServer(AbstractSftpClientTestSupport.class);
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+        sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
         sshd.setCommandFactory(new ScpCommandFactory());
         sshd.start();
         port = sshd.getPort();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
index b673821..cf661ef 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
@@ -54,7 +54,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.file.FileSystemFactory;
 import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
@@ -63,7 +62,6 @@ import org.apache.sshd.common.subsystem.sftp.SftpConstants;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.OsUtils;
 import org.apache.sshd.common.util.io.IoUtils;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.scp.ScpCommandFactory;
 import org.apache.sshd.server.subsystem.sftp.SftpSubsystem;
@@ -93,7 +91,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
     @BeforeClass
     public static void setupServerInstance() throws Exception {
         sshd = Utils.setupTestServer(SftpFileSystemTest.class);
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+        sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
         sshd.setCommandFactory(new ScpCommandFactory());
         sshd.start();
         port = sshd.getPort();
@@ -140,7 +138,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
 
         int expectedVersion = (SftpSubsystem.LOWER_SFTP_IMPL + SftpSubsystem.HIGHER_SFTP_IMPL) / 2;
         params.put(SftpFileSystemProvider.VERSION_PARAM, Integer.valueOf(expectedVersion));
-        try (SftpFileSystem fs = (SftpFileSystem) FileSystems.newFileSystem(createDefaultFileSystemURI(params), Collections.<String, Object>emptyMap())) {
+        try (SftpFileSystem fs = (SftpFileSystem) FileSystems.newFileSystem(createDefaultFileSystemURI(params), Collections.emptyMap())) {
             try (SftpClient sftpClient = fs.getClient()) {
                 assertEquals("Mismatched negotiated version", expectedVersion, sftpClient.getVersion());
 
@@ -223,7 +221,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
 
     @Test
     public void testFileStore() throws IOException {
-        try (FileSystem fs = FileSystems.newFileSystem(createDefaultFileSystemURI(), Collections.<String, Object>emptyMap())) {
+        try (FileSystem fs = FileSystems.newFileSystem(createDefaultFileSystemURI(), Collections.emptyMap())) {
             Iterable<FileStore> iter = fs.getFileStores();
             assertTrue("Not a list", iter instanceof List<?>);
 
@@ -253,7 +251,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
             Collection<SftpFileSystem> fsList = new LinkedList<>();
             try {
                 Collection<String> idSet = new HashSet<>();
-                Map<String, Object> empty = Collections.<String, Object>emptyMap();
+                Map<String, Object> empty = Collections.emptyMap();
                 for (int index = 0; index < 4; index++) {
                     String credentials = getCurrentTestName() + "-user-" + index;
                     SftpFileSystem expected = provider.newFileSystem(createFileSystemURI(credentials, empty), empty);
@@ -464,7 +462,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
     }
 
     private URI createDefaultFileSystemURI() {
-        return createDefaultFileSystemURI(Collections.<String, Object>emptyMap());
+        return createDefaultFileSystemURI(Collections.emptyMap());
     }
 
     private URI createDefaultFileSystemURI(Map<String, ?> params) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
index 0da39a9..ad29b74 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
@@ -270,7 +270,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport {
         int numInvoked = 0;
 
         List<NamedFactory<Command>> factories = sshd.getSubsystemFactories();
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(factory));
+        sshd.setSubsystemFactories(Collections.singletonList(factory));
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
             session.addPasswordIdentity(getCurrentTestName());
             session.auth().verify(5L, TimeUnit.SECONDS);
@@ -390,7 +390,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport {
         int numInvoked = 0;
 
         List<NamedFactory<Command>> factories = sshd.getSubsystemFactories();
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(factory));
+        sshd.setSubsystemFactories(Collections.singletonList(factory));
         try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
             session.addPasswordIdentity(getCurrentTestName());
             session.auth().verify(5L, TimeUnit.SECONDS);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java
index e2ba00d..16f49ba 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java
@@ -60,7 +60,7 @@ import org.junit.runners.Parameterized.Parameters;
 public class CopyDataExtensionImplTest extends AbstractSftpClientTestSupport {
     private static final List<Object[]> PARAMETERS =
             Collections.unmodifiableList(
-                    Arrays.<Object[]>asList(
+                    Arrays.asList(
                             new Object[]{
                                     Integer.valueOf(IoUtils.DEFAULT_COPY_SIZE),
                                     Integer.valueOf(0),

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java
index e3f0c7f..9fb6775 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java
@@ -68,7 +68,7 @@ public class SpaceAvailableExtensionImplTest extends AbstractSftpClientTestSuppo
         final SpaceAvailableExtensionInfo expected = new SpaceAvailableExtensionInfo(store);
 
         List<NamedFactory<Command>> factories = sshd.getSubsystemFactories();
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory() {
+        sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory() {
             @Override
             public Command create() {
                 return new SftpSubsystem(getExecutorService(), isShutdownOnExit(), getUnsupportedAttributePolicy()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java
index 375c846..8557375 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java
@@ -41,7 +41,6 @@ import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHFsyncExte
 import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatExtensionInfo;
 import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatHandleExtension;
 import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatPathExtension;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
 import org.apache.sshd.common.subsystem.sftp.extensions.openssh.AbstractOpenSSHExtensionParser.OpenSSHExtension;
 import org.apache.sshd.common.subsystem.sftp.extensions.openssh.FstatVfsExtensionParser;
@@ -122,7 +121,7 @@ public class OpenSSHExtensionsTest extends AbstractSftpClientTestSupport {
         expected.f_fsid = 1L;
         expected.f_namemax = 256;
 
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory() {
+        sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory() {
             @Override
             public Command create() {
                 return new SftpSubsystem(getExecutorService(), isShutdownOnExit(), getUnsupportedAttributePolicy()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
index 7fefdb3..1393de9 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
@@ -36,7 +36,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.sshd.client.SshClient;
-import org.apache.sshd.client.auth.UserAuth;
 import org.apache.sshd.client.auth.hostbased.HostKeyIdentityProvider;
 import org.apache.sshd.client.auth.keyboard.UserInteraction;
 import org.apache.sshd.client.auth.password.PasswordIdentityProvider;
@@ -172,7 +171,7 @@ public class AuthenticationTest extends BaseTestSupport {
         });
 
         final AtomicInteger changesCount = new AtomicInteger(0);
-        sshd.setUserAuthFactories(Collections.<NamedFactory<org.apache.sshd.server.auth.UserAuth>>singletonList(
+        sshd.setUserAuthFactories(Collections.singletonList(
             new org.apache.sshd.server.auth.password.UserAuthPasswordFactory() {
                 @Override
                 public org.apache.sshd.server.auth.password.UserAuthPassword create() {
@@ -217,7 +216,7 @@ public class AuthenticationTest extends BaseTestSupport {
             });
 
             final AtomicInteger sentCount = new AtomicInteger(0);
-            client.setUserAuthFactories(Collections.<NamedFactory<org.apache.sshd.client.auth.UserAuth>>singletonList(
+            client.setUserAuthFactories(Collections.singletonList(
                 new org.apache.sshd.client.auth.password.UserAuthPasswordFactory() {
                     @Override
                     public org.apache.sshd.client.auth.password.UserAuthPassword create() {
@@ -611,7 +610,7 @@ public class AuthenticationTest extends BaseTestSupport {
         try (SshClient client = setupTestClient()) {
             // force server to use only the RSA key
             final NamedFactory<Signature> kexSignature = BuiltinSignatures.rsa;
-            client.setSignatureFactories(Collections.<NamedFactory<Signature>>singletonList(kexSignature));
+            client.setSignatureFactories(Collections.singletonList(kexSignature));
             client.setServerKeyVerifier(new ServerKeyVerifier() {
                 @Override
                 public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
@@ -627,8 +626,8 @@ public class AuthenticationTest extends BaseTestSupport {
 
             // allow only EC keys for public key authentication
             org.apache.sshd.client.auth.pubkey.UserAuthPublicKeyFactory factory = new org.apache.sshd.client.auth.pubkey.UserAuthPublicKeyFactory();
-            factory.setSignatureFactories(Arrays.<NamedFactory<Signature>>asList(BuiltinSignatures.nistp256, BuiltinSignatures.nistp384, BuiltinSignatures.nistp521));
-            client.setUserAuthFactories(Collections.<NamedFactory<UserAuth>>singletonList(factory));
+            factory.setSignatureFactories(Arrays.asList(BuiltinSignatures.nistp256, BuiltinSignatures.nistp384, BuiltinSignatures.nistp521));
+            client.setUserAuthFactories(Collections.singletonList(factory));
 
             client.start();
             try (ClientSession s = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -643,7 +642,7 @@ public class AuthenticationTest extends BaseTestSupport {
     @Test   // see SSHD-624
     public void testMismatchedUserAuthPkOkData() throws Exception {
         final AtomicInteger challengeCounter = new AtomicInteger(0);
-        sshd.setUserAuthFactories(Collections.<NamedFactory<org.apache.sshd.server.auth.UserAuth>>singletonList(
+        sshd.setUserAuthFactories(Collections.singletonList(
                 new org.apache.sshd.server.auth.pubkey.UserAuthPublicKeyFactory() {
                     @Override
                     public org.apache.sshd.server.auth.pubkey.UserAuthPublicKey create() {
@@ -717,7 +716,7 @@ public class AuthenticationTest extends BaseTestSupport {
         sshd.setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator.NONE);
         sshd.setPublickeyAuthenticator(RejectAllPublickeyAuthenticator.INSTANCE);
         sshd.setUserAuthFactories(
-                Collections.<NamedFactory<org.apache.sshd.server.auth.UserAuth>>singletonList(
+                Collections.singletonList(
                         org.apache.sshd.server.auth.hostbased.UserAuthHostBasedFactory.INSTANCE));
 
         try (SshClient client = setupTestClient()) {
@@ -727,7 +726,7 @@ public class AuthenticationTest extends BaseTestSupport {
             factory.setClientUsername(hostClienUser);
             factory.setClientHostKeys(HostKeyIdentityProvider.Utils.wrap(hostClientKey));
 
-            client.setUserAuthFactories(Collections.<NamedFactory<org.apache.sshd.client.auth.UserAuth>>singletonList(factory));
+            client.setUserAuthFactories(Collections.singletonList(factory));
             client.start();
             try (ClientSession s = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
                 s.auth().verify(11L, TimeUnit.SECONDS);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
index 6c6cf0b..5a0f953 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
@@ -69,7 +69,7 @@ public class ChannelPipedInputStreamTest extends BaseTestSupport {
     private static ChannelPipedInputStream createTestStream() {
         AbstractChannel channel = new BogusChannel();
         Window window = new Window(channel, null, true, true);
-        window.init(PropertyResolverUtils.toPropertyResolver(Collections.<String, Object>emptyMap()));
+        window.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
         return new ChannelPipedInputStream(channel, window);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
index 3d21f80..e19c0bb 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
@@ -36,7 +36,6 @@ import org.apache.sshd.client.channel.ClientChannel;
 import org.apache.sshd.client.future.OpenFuture;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.RuntimeSshException;
 import org.apache.sshd.common.Service;
@@ -106,7 +105,7 @@ public class WindowTest extends BaseTestSupport {
                 },
                 ServerConnectionServiceFactory.INSTANCE
         ));
-        sshd.setChannelFactories(Arrays.<NamedFactory<Channel>>asList(
+        sshd.setChannelFactories(Arrays.asList(
                 new ChannelSessionFactory() {
                     @Override
                     public Channel create() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java b/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
index a6926b8..7d74d81 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
@@ -211,7 +211,7 @@ public class BuiltinCiphersTest extends BaseTestSupport {
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
-                    useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+                    useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
                 }
 
                 if (useBuiltin) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java b/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
index 36883cc..c5a76a3 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
@@ -129,7 +129,7 @@ public class CipherTest extends BaseTestSupport {
     @Test
     public void testBuiltinCipherSession() throws Exception {
         Assume.assumeTrue("No internal support for " + builtInCipher.getName(), builtInCipher.isSupported() && checkCipher(jschCipher.getName()));
-        sshd.setCipherFactories(Collections.<NamedFactory<org.apache.sshd.common.cipher.Cipher>>singletonList(builtInCipher));
+        sshd.setCipherFactories(Collections.singletonList(builtInCipher));
         runJschTest(port);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
index a122518..a0a2828 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
@@ -87,7 +87,7 @@ public class BuiltinCompressionsTest extends BaseTestSupport {
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
-                    useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+                    useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
                 }
 
                 if (useBuiltin) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java b/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
index 59f2af9..b2dec83 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
@@ -29,7 +29,6 @@ import java.util.List;
 
 import com.jcraft.jsch.JSch;
 
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.channel.Channel;
 import org.apache.sshd.common.kex.KexProposalOption;
 import org.apache.sshd.common.mac.MacTest;
@@ -113,7 +112,7 @@ public class CompressionTest extends BaseTestSupport {
 
     @Before
     public void setUp() throws Exception {
-        sshd.setCompressionFactories(Arrays.<NamedFactory<org.apache.sshd.common.compression.Compression>>asList(factory));
+        sshd.setCompressionFactories(Arrays.asList(factory));
         sshd.addSessionListener(listener);
 
         String name = factory.getName();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java b/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
index 32131c3..be95fcf 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
@@ -67,7 +67,7 @@ public class RootedFileSystemProviderTest extends AssertableFile {
                 Utils.detectTargetFolder(RootedFileSystemProviderTest.class), "Failed to detect target folder").toPath();
         rootSandbox = FileHelper.createTestSandbox(targetFolder.resolve(TEMP_SUBFOLDER_NAME));
         fileSystem = (RootedFileSystem) new RootedFileSystemProvider().newFileSystem(rootSandbox,
-                Collections.<String, Object> emptyMap());
+                Collections.emptyMap());
     }
 
     @Test
@@ -217,8 +217,8 @@ public class RootedFileSystemProviderTest extends AssertableFile {
         RootedFileSystemProvider provider = new RootedFileSystemProvider();
         Path tempFolder = assertHierarchyTargetFolderExists(getTempTargetFolder());
         Path file = Files.createTempFile(tempFolder, getCurrentTestName(), ".txt");
-        try (FileSystem fs = provider.newFileSystem(tempFolder, Collections.<String, Object>emptyMap());
-             Channel channel = provider.newByteChannel(fs.getPath(file.getFileName().toString()), Collections.<OpenOption>emptySet())) {
+        try (FileSystem fs = provider.newFileSystem(tempFolder, Collections.emptyMap());
+             Channel channel = provider.newByteChannel(fs.getPath(file.getFileName().toString()), Collections.emptySet())) {
             assertTrue("Channel not open", channel.isOpen());
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java b/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java
index 5d69f0a..ee98a22 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java
@@ -388,7 +388,7 @@ public class BasePathTest extends BaseTestSupport {
         private final FileSystem fileSystem;
         private final String string;
         private String root;
-        private List<String> names = Collections.<String>emptyList();
+        private List<String> names = Collections.emptyList();
 
         public PathTester(FileSystem fileSystem, String string) {
             this.fileSystem = fileSystem;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java b/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
index c9bf9e5..965c7d4 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
@@ -56,12 +56,12 @@ public class DefaultIoServiceFactoryFactoryTest extends BaseTestSupport {
     @Test
     public void testExecutorServiceInitialization() throws IOException {
         ExecutorService service = Mockito.mock(ExecutorService.class);
-        Mockito.when(service.shutdownNow()).thenReturn(Collections.<Runnable>emptyList());
+        Mockito.when(service.shutdownNow()).thenReturn(Collections.emptyList());
         Mockito.when(service.isShutdown()).thenReturn(Boolean.TRUE);
         Mockito.when(service.isTerminated()).thenReturn(Boolean.TRUE);
 
         FactoryManager manager = Mockito.mock(FactoryManager.class);
-        Mockito.when(manager.getProperties()).thenReturn(Collections.<String, Object>emptyMap());
+        Mockito.when(manager.getProperties()).thenReturn(Collections.emptyMap());
 
         String propName = IoServiceFactoryFactory.class.getName();
         for (BuiltinIoServiceFactoryFactories f : BuiltinIoServiceFactoryFactories.VALUES) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java b/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
index 8cfb1ee..74a7804 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
@@ -82,7 +82,7 @@ public class BuiltinDHFactoriesTest extends BaseTestSupport {
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
-                    useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+                    useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
                 }
 
                 if (useBuiltin) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
index 10af615..7972b25 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
@@ -82,7 +82,7 @@ public class BuiltinMacsTest extends BaseTestSupport {
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
-                    useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+                    useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
                 }
 
                 if (useBuiltin) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
index 20e5c69..86e74af 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
@@ -32,7 +32,6 @@ import java.util.concurrent.TimeUnit;
 
 import com.jcraft.jsch.JSch;
 
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.channel.Channel;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.server.SshServer;
@@ -145,7 +144,7 @@ public class MacTest extends BaseTestSupport {
 
     @Before
     public void setUp() throws Exception {
-        sshd.setMacFactories(Arrays.<NamedFactory<Mac>>asList(factory));
+        sshd.setMacFactories(Arrays.asList(factory));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java
index da714c5..c8a8b24 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java
@@ -200,7 +200,7 @@ public class MacVectorsTest extends BaseTestSupport {
                     */
 
                     // mark end
-                    new VectorTestData("", false, "", false, Collections.<Pair<String, String>>emptyList())))) {
+                    new VectorTestData("", false, "", false, Collections.emptyList())))) {
             for (Pair<String, String> tc : vector.getResults()) {
                 ret.add(new Object[]{vector, tc.getFirst(), tc.getSecond()});
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java b/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
index 604d76e..356846c 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
@@ -65,7 +65,7 @@ public class BuiltinSignaturesTest extends BaseTestSupport {
             for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
                 boolean useBuiltin = false;
                 if (bIndex < builtin.size()) {
-                    useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+                    useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
                 }
 
                 if (useBuiltin) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
index 7b22fbe..4db0e0a 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
@@ -91,7 +91,7 @@ public class EventListenerUtilsTest extends BaseTestSupport {
     @Test
     public void testSynchronizedListenersSetOnProxies() {
         ProxyListener p1 = EventListenerUtils.proxyWrapper(ProxyListener.class, Collections.singletonList(new ProxyListenerImpl()));
-        Set<ProxyListener> s = EventListenerUtils.<ProxyListener>synchronizedListenersSet();
+        Set<ProxyListener> s = EventListenerUtils.synchronizedListenersSet();
         for (int index = 1; index <= Byte.SIZE; index++) {
             boolean modified = s.add(p1);
             assertEquals("Mismatched p1 modification indicator at attempt #" + index, index == 1, modified);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
index bffbe62..8907b2e 100644
--- a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
+++ b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
@@ -85,7 +85,7 @@ public class UserAuthAgent extends AbstractUserAuth {
         } catch (IOException e) {
             throw e;
         } catch (Exception e) {
-            throw (IOException) new IOException("Error performing public key authentication").initCause(e);
+            throw (IOException) new IOException("Error performing public key authentication", e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
index 1f9be26..6593c0a 100644
--- a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
+++ b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
@@ -89,7 +89,7 @@ public class UserAuthPublicKey extends AbstractUserAuth {
             } catch (IOException e) {
                 throw e;
             } catch (Exception e) {
-                throw (IOException) new IOException("Error performing public key authentication").initCause(e);
+                throw (IOException) new IOException("Error performing public key authentication", e);
             }
         } else {
             int cmd = buffer.getUByte();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
index 5fcaba2..56122c8 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
@@ -41,7 +41,6 @@ import org.apache.sshd.common.mac.Mac;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.session.SessionListener;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.server.auth.UserAuth;
 import org.apache.sshd.server.auth.keyboard.KeyboardInteractiveAuthenticator;
 import org.apache.sshd.server.auth.password.PasswordAuthenticator;
 import org.apache.sshd.server.auth.password.PasswordChangeRequiredException;
@@ -214,7 +213,7 @@ public class ServerSessionListenerTest extends BaseTestSupport {
                     ServerSession serverSession = (ServerSession) session;
                     serverSession.setPasswordAuthenticator(passAuth);
                     serverSession.setUserAuthFactories(
-                            Collections.<NamedFactory<UserAuth>>singletonList(
+                            Collections.singletonList(
                                     ServerAuthenticationManager.Utils.DEFAULT_USER_AUTH_PASSWORD_FACTORY));
                 }
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
index e3e40f2..e62e8de 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
@@ -104,7 +104,7 @@ public class WelcomeBannerTest extends BaseTestSupport {
 
     @Test
     public void testPathBanner() throws Exception {
-        testFileContentBanner(Function.<Path>identity());
+        testFileContentBanner(Function.identity());
     }
 
     @Test