You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2017/12/28 10:43:08 UTC

[1/3] mina-sshd git commit: Removed deprecated usage of arg4j ExampleMode

Repository: mina-sshd
Updated Branches:
  refs/heads/master 154287462 -> 3e2b4f8e2


Removed deprecated usage of arg4j ExampleMode


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

Branch: refs/heads/master
Commit: 3e2b4f8e2ce301ea3d77585c7bf48dd0a9ea4bd5
Parents: 74b6918
Author: Goldstein Lyor <ly...@c-b4.com>
Authored: Thu Dec 28 12:42:04 2017 +0200
Committer: Goldstein Lyor <ly...@c-b4.com>
Committed: Thu Dec 28 12:42:58 2017 +0200

----------------------------------------------------------------------
 .../sshd/git/pgm/EmbeddedCommandRunner.java     | 23 ++++++++------------
 1 file changed, 9 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/3e2b4f8e/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 0b1f3c7..8ccc510 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
@@ -42,8 +42,8 @@ import org.eclipse.jgit.pgm.opt.SubcommandHandler;
 import org.eclipse.jgit.util.io.ThrowingPrintWriter;
 import org.kohsuke.args4j.Argument;
 import org.kohsuke.args4j.CmdLineException;
-import org.kohsuke.args4j.ExampleMode;
 import org.kohsuke.args4j.Option;
+import org.kohsuke.args4j.OptionHandlerFilter;
 
 /**
  * TODO Add javadoc
@@ -75,16 +75,11 @@ public class EmbeddedCommandRunner {
     /**
      * Execute a command.
      *
-     * @param argv
-     *          the command and its arguments
-     * @param in
-     *          the input stream, may be null in which case the system input stream will be used
-     * @param out
-     *          the output stream, may be null in which case the system output stream will be used
-     * @param err
-     *          the error stream, may be null in which case the system error stream will be used
-     * @throws Exception
-     *          if an error occurs
+     * @param argv the command and its arguments
+     * @param in the input stream, may be null in which case the system input stream will be used
+     * @param out the output stream, may be null in which case the system output stream will be used
+     * @param err the error stream, may be null in which case the system error stream will be used
+     * @throws Exception if an error occurs
      */
     public void execute(final String[] argv, InputStream in, OutputStream out, OutputStream err) throws Exception {
         final CmdLineParser clp = new CmdLineParser(this);
@@ -100,7 +95,7 @@ public class EmbeddedCommandRunner {
         }
 
         if (argv.length == 0 || help) {
-            final String ex = clp.printExample(ExampleMode.ALL, CLIText.get().resourceBundle());
+            final String ex = clp.printExample(OptionHandlerFilter.ALL, CLIText.get().resourceBundle());
             writer.println("jgit" + ex + " command [ARG ...]"); //$NON-NLS-1$
             if (help) {
                 writer.println();
@@ -152,8 +147,8 @@ public class EmbeddedCommandRunner {
         set(cmd, "ins", in);
         set(cmd, "outs", out);
         set(cmd, "errs", err);
-        
-        Boolean success = (Boolean) call(cmd, "requiresRepository"); 
+
+        Boolean success = (Boolean) call(cmd, "requiresRepository");
         if (success) {
             call(cmd, "init", new Class[] {Repository.class, String.class}, new Object[] {openGitDir(gitdir), gitdir});
         } else {


[2/3] mina-sshd git commit: Replaced all usages of Pair with SimpleImmutableEntry (exists since Java 1.6)

Posted by lg...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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
deleted file mode 100644
index 5cb56d5..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/Pair.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sshd.common.util;
-
-import java.util.Comparator;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Represents an un-modifiable pair of values
- *
- * @param <F> First value type
- * @param <S> Second value type
- * @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", "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;
-    private final S second;
-
-    public Pair(F first, S second) {
-        this.first = first;
-        this.second = second;
-    }
-
-    @Override
-    public final F getKey() {
-        return getFirst();
-    }
-
-    @Override
-    public S getValue() {
-        return getSecond();
-    }
-
-    @Override
-    public S setValue(S value) {
-        throw new UnsupportedOperationException("setValue(" + value + ") N/A");
-    }
-
-    public final F getFirst() {
-        return first;
-    }
-
-    public final S getSecond() {
-        return second;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(getFirst()) * 31 + Objects.hashCode(getSecond());
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-
-        if (obj == this) {
-            return true;
-        }
-
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-
-        Pair<?, ?> other = (Pair<?, ?>)obj;
-        return Objects.equals(getFirst(), other.getFirst()) && Objects.equals(getSecond(), other.getSecond());
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toString(getFirst()) + ", " + Objects.toString(getSecond());
-    }
-
-    /**
-     * @param <K> The {@link Comparable} key type
-     * @param <V> The associated entry value
-     * @return A {@link Comparator} for {@link java.util.Map.Entry}-ies that
-     * compares the key values
-     */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public static <K extends Comparable<K>, V> Comparator<Map.Entry<K, V>> byKeyEntryComparator() {
-        return (Comparator) BY_KEY_COMPARATOR;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 ba8c276..032260b 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
@@ -27,6 +27,7 @@ import java.nio.file.Path;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.nio.file.attribute.FileTime;
 import java.nio.file.attribute.PosixFilePermission;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumSet;
@@ -38,7 +39,6 @@ import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.OsUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
 
 /**
@@ -209,14 +209,14 @@ public class ModifiableFileWatcher extends AbstractLoggingBean {
      * @param path    The {@link Path} to be checked - ignored if {@code null}
      *                or does not exist
      * @param options The {@link LinkOption}s to use to query the file's permissions
-     * @return The violated permission as {@link Pair} where {@link Pair#getClass()}
-     * is a loggable message and {@link Pair#getSecond()} is the offending object
+     * @return The violated permission as {@link SimpleImmutableEntry} where key
+     * is a loggable message and value is the offending object
      * - e.g., {@link PosixFilePermission} or {@link String} for owner. Return
      * value is {@code null} if no violations detected
      * @throws IOException If failed to retrieve the permissions
      * @see #STRICTLY_PROHIBITED_FILE_PERMISSION
      */
-    public static Pair<String, Object> validateStrictConfigFilePermissions(Path path, LinkOption... options) throws IOException {
+    public static SimpleImmutableEntry<String, Object> validateStrictConfigFilePermissions(Path path, LinkOption... options) throws IOException {
         if ((path == null) || (!Files.exists(path, options))) {
             return null;
         }
@@ -229,7 +229,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.format("Permissions violation (%s)", p), p);
+                return new SimpleImmutableEntry<>(String.format("Permissions violation (%s)", p), p);
             }
         }
 
@@ -250,7 +250,7 @@ public class ModifiableFileWatcher extends AbstractLoggingBean {
         }
 
         if (!expected.contains(owner)) {
-            return new Pair<>(String.format("Owner violation (%s)", owner), owner);
+            return new SimpleImmutableEntry<>(String.format("Owner violation (%s)", owner), owner);
         }
 
         return null;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/SignatureEd25519.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/SignatureEd25519.java b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/SignatureEd25519.java
index cd601f6..0d16812 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/SignatureEd25519.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/SignatureEd25519.java
@@ -18,11 +18,12 @@
  */
 package org.apache.sshd.common.util.security.eddsa;
 
+import java.util.Map;
+
 import net.i2p.crypto.eddsa.EdDSAEngine;
 
 import org.apache.sshd.common.keyprovider.KeyPairProvider;
 import org.apache.sshd.common.signature.AbstractSignature;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 
 /**
@@ -36,11 +37,11 @@ public class SignatureEd25519 extends AbstractSignature {
     @Override
     public boolean verify(byte[] sig) throws Exception {
         byte[] data = sig;
-        Pair<String, byte[]> encoding = extractEncodedSignature(data);
+        Map.Entry<String, byte[]> encoding = extractEncodedSignature(data);
         if (encoding != null) {
-            String keyType = encoding.getFirst();
+            String keyType = encoding.getKey();
             ValidateUtils.checkTrue(KeyPairProvider.SSH_ED25519.equals(keyType), "Mismatched key type: %s", keyType);
-            data = encoding.getSecond();
+            data = encoding.getValue();
         }
 
         return doVerify(data);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java
index fc7070a..9fac9e6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java
@@ -27,13 +27,13 @@ import java.nio.file.Path;
 import java.nio.file.attribute.PosixFilePermission;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Map;
 import java.util.Objects;
 
 import org.apache.sshd.common.auth.UsernameHolder;
 import org.apache.sshd.common.config.keys.AuthorizedKeyEntry;
 import org.apache.sshd.common.config.keys.KeyUtils;
 import org.apache.sshd.common.util.OsUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.io.IoUtils;
 import org.apache.sshd.server.session.ServerSession;
@@ -113,10 +113,10 @@ public class DefaultAuthorizedKeysAuthenticator extends AuthorizedKeysAuthentica
                 log.debug("reloadAuthorizedKeys({})[{}] check permissions of {}", username, session, path);
             }
 
-            Pair<String, Object> violation = KeyUtils.validateStrictKeyFilePermissions(path);
+            Map.Entry<String, ?> violation = KeyUtils.validateStrictKeyFilePermissions(path);
             if (violation != null) {
                 log.warn("reloadAuthorizedKeys({})[{}] invalid file={} permissions: {}",
-                         username, session, path, violation.getFirst());
+                         username, session, path, violation.getKey());
                 updateReloadAttributes();
                 return Collections.emptyList();
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpSubsystemHelper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpSubsystemHelper.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpSubsystemHelper.java
index a54a7d5..2e043fb 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpSubsystemHelper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpSubsystemHelper.java
@@ -51,6 +51,7 @@ import java.nio.file.attribute.UserPrincipal;
 import java.nio.file.attribute.UserPrincipalLookupService;
 import java.nio.file.attribute.UserPrincipalNotFoundException;
 import java.security.Principal;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -91,7 +92,6 @@ import org.apache.sshd.common.util.EventListenerUtils;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.NumberUtils;
 import org.apache.sshd.common.util.OsUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.SelectorUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
@@ -1180,7 +1180,7 @@ public abstract class AbstractSftpSubsystemHelper
         }
 
         Map<String, ?> attrs = Collections.emptyMap();
-        Pair<Path, Boolean> result;
+        Map.Entry<Path, Boolean> result;
         try {
             int version = getVersion();
             if (version < SftpConstants.SFTP_V6) {
@@ -1222,9 +1222,9 @@ public abstract class AbstractSftpSubsystemHelper
                     getPathResolutionLinkOption(SftpConstants.SSH_FXP_REALPATH, "", p);
                 result = doRealPathV6(id, path, extraPaths, p, options);
 
-                p = result.getFirst();
+                p = result.getKey();
                 options = getPathResolutionLinkOption(SftpConstants.SSH_FXP_REALPATH, "", p);
-                Boolean status = result.getSecond();
+                Boolean status = result.getValue();
                 switch (control) {
                     case SftpConstants.SSH_FXP_REALPATH_STAT_IF:
                         if (status == null) {
@@ -1268,10 +1268,10 @@ public abstract class AbstractSftpSubsystemHelper
             return;
         }
 
-        sendPath(BufferUtils.clear(buffer), id, result.getFirst(), attrs);
+        sendPath(BufferUtils.clear(buffer), id, result.getKey(), attrs);
     }
 
-    protected Pair<Path, Boolean> doRealPathV6(
+    protected SimpleImmutableEntry<Path, Boolean> doRealPathV6(
             int id, String path, Collection<String> extraPaths, Path p, LinkOption... options) throws IOException {
         int numExtra = GenericUtils.size(extraPaths);
         if (numExtra > 0) {
@@ -1294,7 +1294,7 @@ public abstract class AbstractSftpSubsystemHelper
         return validateRealPath(id, path, p, options);
     }
 
-    protected Pair<Path, Boolean> doRealPathV345(int id, String path, Path p, LinkOption... options) throws IOException {
+    protected SimpleImmutableEntry<Path, Boolean> doRealPathV345(int id, String path, Path p, LinkOption... options) throws IOException {
         return validateRealPath(id, path, p, options);
     }
 
@@ -1303,15 +1303,15 @@ public abstract class AbstractSftpSubsystemHelper
      * @param path    The original path
      * @param f       The resolve {@link Path}
      * @param options The {@link LinkOption}s to use to verify file existence and access
-     * @return A {@link Pair} whose left-hand is the <U>absolute <B>normalized</B></U>
-     * {@link Path} and right-hand is a {@link Boolean} indicating its status
+     * @return A {@link SimpleImmutableEntry} whose key is the <U>absolute <B>normalized</B></U>
+     * {@link Path} and value is a {@link Boolean} indicating its status
      * @throws IOException If failed to validate the file
      * @see IoUtils#checkFileExists(Path, LinkOption...)
      */
-    protected Pair<Path, Boolean> validateRealPath(int id, String path, Path f, LinkOption... options) throws IOException {
+    protected SimpleImmutableEntry<Path, Boolean> validateRealPath(int id, String path, Path f, LinkOption... options) throws IOException {
         Path p = normalize(f);
         Boolean status = IoUtils.checkFileExists(p, options);
-        return new Pair<>(p, status);
+        return new SimpleImmutableEntry<>(p, status);
     }
 
     protected void doRemoveDirectory(Buffer buffer, int id) throws IOException {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java b/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java
index eaf3deb..113dc98 100644
--- a/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java
@@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets;
 import java.security.KeyPair;
 import java.security.PublicKey;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.agent.local.LocalAgentFactory;
@@ -36,7 +37,6 @@ import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.channel.ChannelShell;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.keyprovider.KeyPairProvider;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.security.SecurityUtils;
 import org.apache.sshd.server.Command;
 import org.apache.sshd.server.Environment;
@@ -82,7 +82,7 @@ public class AgentTest extends BaseTestSupport {
             String authSocket = agent.start();
 
             try (SshAgent client = new AgentClient(authSocket)) {
-                List<Pair<PublicKey, String>> keys = client.getIdentities();
+                List<? extends Map.Entry<PublicKey, String>> keys = client.getIdentities();
                 assertNotNull("No initial identities", keys);
                 assertEquals("Unexpected initial identities size", 0, keys.size());
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 d636096..b491c61 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
@@ -29,6 +29,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.client.session.ClientSession;
@@ -46,7 +47,6 @@ import org.apache.sshd.common.subsystem.sftp.SftpConstants;
 import org.apache.sshd.common.subsystem.sftp.SftpException;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.NumberUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.common.util.io.IoUtils;
 import org.apache.sshd.util.test.JUnit4ClassRunnerWithParametersFactory;
@@ -184,8 +184,8 @@ public class AbstractCheckFileExtensionTest extends AbstractSftpClientTestSuppor
             try (SftpClient sftp = session.createSftpClient()) {
                 CheckFileNameExtension file = assertExtensionCreated(sftp, CheckFileNameExtension.class);
                 try {
-                    Pair<String, ?> result = file.checkFileName(srcFolder, algorithms, 0L, 0L, hashBlockSize);
-                    fail("Unexpected success to hash folder=" + srcFolder + ": " + result.getFirst());
+                    Map.Entry<String, ?> result = file.checkFileName(srcFolder, algorithms, 0L, 0L, hashBlockSize);
+                    fail("Unexpected success to hash folder=" + srcFolder + ": " + result.getKey());
                 } catch (IOException e) {    // expected - not allowed to hash a folder
                     assertTrue("Not an SftpException", e instanceof SftpException);
                 }
@@ -193,8 +193,8 @@ public class AbstractCheckFileExtensionTest extends AbstractSftpClientTestSuppor
                 CheckFileHandleExtension hndl = assertExtensionCreated(sftp, CheckFileHandleExtension.class);
                 try (CloseableHandle dirHandle = sftp.openDir(srcFolder)) {
                     try {
-                        Pair<String, ?> result = hndl.checkFileHandle(dirHandle, algorithms, 0L, 0L, hashBlockSize);
-                        fail("Unexpected handle success on folder=" + srcFolder + ": " + result.getFirst());
+                        Map.Entry<String, ?> result = hndl.checkFileHandle(dirHandle, algorithms, 0L, 0L, hashBlockSize);
+                        fail("Unexpected handle success on folder=" + srcFolder + ": " + result.getKey());
                     } catch (IOException e) {    // expected - not allowed to hash a folder
                         assertTrue("Not an SftpException", e instanceof SftpException);
                     }
@@ -208,13 +208,13 @@ public class AbstractCheckFileExtensionTest extends AbstractSftpClientTestSuppor
         }
     }
 
-    private void validateHashResult(NamedResource hasher, Pair<String, Collection<byte[]>> result, String expectedAlgorithm, byte[] expectedHash) {
+    private void validateHashResult(NamedResource hasher, Map.Entry<String, ? extends Collection<byte[]>> result, String expectedAlgorithm, byte[] expectedHash) {
         String name = hasher.getName();
         assertNotNull("No result for hash=" + name, result);
-        assertEquals("Mismatched hash algorithms for " + name, expectedAlgorithm, result.getFirst());
+        assertEquals("Mismatched hash algorithms for " + name, expectedAlgorithm, result.getKey());
 
         if (NumberUtils.length(expectedHash) > 0) {
-            Collection<byte[]> values = result.getSecond();
+            Collection<byte[]> values = result.getValue();
             assertEquals("Mismatched hash values count for " + name, 1, GenericUtils.size(values));
 
             byte[] actualHash = values.iterator().next();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 ebc8752..74f0471 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
@@ -22,10 +22,10 @@ package org.apache.sshd.common.config.keys;
 import java.io.IOException;
 import java.security.GeneralSecurityException;
 import java.security.PublicKey;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Arrays;
 import java.util.Collection;
 
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.JUnit4ClassRunnerWithParametersFactory;
 import org.junit.BeforeClass;
@@ -88,6 +88,6 @@ public class KeyUtilsFingerprintCaseSensitivityTest extends BaseTestSupport {
 
     @Test
     public void testCase() throws Exception {
-        assertEquals("Check failed", new Pair<>(true, expected), KeyUtils.checkFingerPrint(test, key));
+        assertEquals("Check failed", new SimpleImmutableEntry<>(true, expected), KeyUtils.checkFingerPrint(test, key));
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 c43a64f..dc37741 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
@@ -23,15 +23,16 @@ import java.io.IOException;
 import java.security.GeneralSecurityException;
 import java.security.PublicKey;
 import java.security.spec.InvalidKeySpecException;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.sshd.common.digest.BuiltinDigests;
 import org.apache.sshd.common.digest.DigestFactory;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.JUnit4ClassRunnerWithParametersFactory;
 import org.junit.FixMethodOrder;
@@ -61,63 +62,63 @@ public class KeyUtilsFingerprintGenerationTest extends BaseTestSupport {
 
     @Parameters(name = "key={0}, digestFactory={1}, expected={2}")
     public static Collection<Object[]> parameters() throws IOException, GeneralSecurityException {
-        @SuppressWarnings("cast")
-        List<Pair<String, List<Pair<DigestFactory, String>>>> keyEntries = Collections.unmodifiableList(Arrays.asList(
-            new Pair<>(
-                // CHECKSTYLE:OFF
-                "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxr3N5fkt966xJINl0hH7Q6lLDRR1D0yMjcXCE5roE9VFut2ctGFuo90TCOxkPOMnwzwConeyScVF4ConZeWsxbG9VtRh61IeZ6R5P5ZTvE9xPdZBgIEWvU1bRfrrOfSMihqF98pODspE6NoTtND2eglwSGwxcYFmpdTAmu+8qgxgGxlEaaCjqwdiNPZhygrH81Mv2ruolNeZkn4Bj+wFFmZTD/waN1pQaMf+SO1+kEYIYFNl5+8JRGuUcr8MhHHJB+gwqMTF2BSBVITJzZUiQR0TMtkK6Vbs7yt1F9hhzDzAFDwhV+rsfNQaOHpl3zP07qH+/99A0XG1CVcEdHqVMw== lgoldstein@LGOLDSTEIN-WIN7",
-                // CHECKSTYLE:ON
-                Arrays.asList(
-                    new Pair<>(
-                        BuiltinDigests.md5,
-                        "MD5:24:32:3c:80:01:b3:e1:fa:7c:53:ca:e3:e8:4e:c6:8e"
-                    ),
-                    new Pair<>(
-                        BuiltinDigests.sha256,
-                        "SHA256:1wNOZO+/XgNGJMx8UUJst33V+bBMTz5EcL0B6y2iRv0"
+        List<? extends Map.Entry<String, List<? extends Map.Entry<DigestFactory, String>>>> keyEntries =
+            Collections.unmodifiableList(Arrays.asList(
+                new SimpleImmutableEntry<>(
+                    // CHECKSTYLE:OFF
+                    "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxr3N5fkt966xJINl0hH7Q6lLDRR1D0yMjcXCE5roE9VFut2ctGFuo90TCOxkPOMnwzwConeyScVF4ConZeWsxbG9VtRh61IeZ6R5P5ZTvE9xPdZBgIEWvU1bRfrrOfSMihqF98pODspE6NoTtND2eglwSGwxcYFmpdTAmu+8qgxgGxlEaaCjqwdiNPZhygrH81Mv2ruolNeZkn4Bj+wFFmZTD/waN1pQaMf+SO1+kEYIYFNl5+8JRGuUcr8MhHHJB+gwqMTF2BSBVITJzZUiQR0TMtkK6Vbs7yt1F9hhzDzAFDwhV+rsfNQaOHpl3zP07qH+/99A0XG1CVcEdHqVMw== lgoldstein@LGOLDSTEIN-WIN7",
+                    // CHECKSTYLE:ON
+                    Arrays.asList(
+                        new SimpleImmutableEntry<>(
+                            BuiltinDigests.md5,
+                            "MD5:24:32:3c:80:01:b3:e1:fa:7c:53:ca:e3:e8:4e:c6:8e"
+                        ),
+                        new SimpleImmutableEntry<>(
+                            BuiltinDigests.sha256,
+                            "SHA256:1wNOZO+/XgNGJMx8UUJst33V+bBMTz5EcL0B6y2iRv0"
+                        )
                     )
-                )
-            ),
-            new Pair<>(
-                // CHECKSTYLE:OFF
-                "ssh-dss AAAAB3NzaC1kc3MAAACBAMg/IxsG5BxnF5gM7IKqqR0rftxZC+n5GlbO+J4H+iIb/KR8NBehkxG3CrBZMF96M2K1sEGYLob+3k4r71oWaPul8n5rt9kpd+JSq4iD2ygOyg6Kd1/YDBHoxneizy6I/bGsLwhAAKWcRNrXmYVKGzhrhvZWN12AJDq2mGdj3szLAAAAFQD7a2MltdUSF7FU3//SpW4WGjZbeQAAAIBf0nNsfKQL/TEMo7IpTrEMg5V0RnSigCX0+yUERS42GW/ZeCZBJw7oL2XZbuBtu63vMjDgVpnb92BdrcPgjJ7EFW6DlcyeuywStmg1ygXmDR2AQCxv0eX2CQgrdUczmRa155SDVUTvTQlO1IyKx0vwKAh1H7E3yJUfkTAJstbGYQAAAIEAtv+cdRfNevYFkp55jVqazc8zRLvfb64jzgc5oSJVc64kFs4yx+abYpGX9WxNxDlG6g2WiY8voDBB0YnUJsn0kVRjBKX9OceROxrfT4K4dVbQZsdt+SLaXWL4lGJFrFZL3LZqvySvq6xfhJfakQDDivW4hUOhFPXPHrE5/Ia3T7A= dsa-key-20130709",
-                // CHECKSTYLE:ON
-                Arrays.asList(
-                    new Pair<>(
-                        BuiltinDigests.md5,
-                        "MD5:fb:29:14:8d:94:f9:1d:cf:6b:0e:a4:35:1d:83:44:2f"
-                    ),
-                    new Pair<>(
-                        BuiltinDigests.sha256,
-                        "SHA256:grxw4KhY1cK6eOczBWs7tDVvo9V0PQw4E1wN1gJvHlw"
+                ),
+                new SimpleImmutableEntry<>(
+                    // CHECKSTYLE:OFF
+                    "ssh-dss AAAAB3NzaC1kc3MAAACBAMg/IxsG5BxnF5gM7IKqqR0rftxZC+n5GlbO+J4H+iIb/KR8NBehkxG3CrBZMF96M2K1sEGYLob+3k4r71oWaPul8n5rt9kpd+JSq4iD2ygOyg6Kd1/YDBHoxneizy6I/bGsLwhAAKWcRNrXmYVKGzhrhvZWN12AJDq2mGdj3szLAAAAFQD7a2MltdUSF7FU3//SpW4WGjZbeQAAAIBf0nNsfKQL/TEMo7IpTrEMg5V0RnSigCX0+yUERS42GW/ZeCZBJw7oL2XZbuBtu63vMjDgVpnb92BdrcPgjJ7EFW6DlcyeuywStmg1ygXmDR2AQCxv0eX2CQgrdUczmRa155SDVUTvTQlO1IyKx0vwKAh1H7E3yJUfkTAJstbGYQAAAIEAtv+cdRfNevYFkp55jVqazc8zRLvfb64jzgc5oSJVc64kFs4yx+abYpGX9WxNxDlG6g2WiY8voDBB0YnUJsn0kVRjBKX9OceROxrfT4K4dVbQZsdt+SLaXWL4lGJFrFZL3LZqvySvq6xfhJfakQDDivW4hUOhFPXPHrE5/Ia3T7A= dsa-key-20130709",
+                    // CHECKSTYLE:ON
+                    Arrays.asList(
+                        new SimpleImmutableEntry<>(
+                            BuiltinDigests.md5,
+                            "MD5:fb:29:14:8d:94:f9:1d:cf:6b:0e:a4:35:1d:83:44:2f"
+                        ),
+                        new SimpleImmutableEntry<>(
+                            BuiltinDigests.sha256,
+                            "SHA256:grxw4KhY1cK6eOczBWs7tDVvo9V0PQw4E1wN1gJvHlw"
+                        )
                     )
-                )
-            ),
-            new Pair<>(
-                // CHECKSTYLE:OFF
-                "ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBFImZtcTj842stlcVHLFBFxTEx7lu3jW9aZCvd0r9fUNKZ6LbRPh6l1oJ4ozArnw7XreQBUc5oNd9HB5RNJ8jl1nWXY5cXBA7McZrKZrYmk+zxNhH6UL+kMLaJkyngJHQw== root@osv-linux",
-                // CHECKSTYLE:ON
-                Arrays.asList(
-                    new Pair<>(
-                        BuiltinDigests.md5,
-                        "MD5:e6:dc:a2:4f:5b:11:b2:3c:0f:e8:f6:d8:d1:01:e9:d3"
-                    ),
-                    new Pair<>(
-                        BuiltinDigests.sha512,
-                        "SHA512:4w6ZB78tmFWhpN2J50Ok6WeMJhZp1X0xN0EKWxZmRLcYDbCWhyJDe8lgrQKWqdTCMZ5aNEBl9xQUklcC5Gt2jg"
+                ),
+                new SimpleImmutableEntry<>(
+                    // CHECKSTYLE:OFF
+                    "ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBFImZtcTj842stlcVHLFBFxTEx7lu3jW9aZCvd0r9fUNKZ6LbRPh6l1oJ4ozArnw7XreQBUc5oNd9HB5RNJ8jl1nWXY5cXBA7McZrKZrYmk+zxNhH6UL+kMLaJkyngJHQw== root@osv-linux",
+                    // CHECKSTYLE:ON
+                    Arrays.asList(
+                        new SimpleImmutableEntry<>(
+                            BuiltinDigests.md5,
+                            "MD5:e6:dc:a2:4f:5b:11:b2:3c:0f:e8:f6:d8:d1:01:e9:d3"
+                        ),
+                        new SimpleImmutableEntry<>(
+                            BuiltinDigests.sha512,
+                            "SHA512:4w6ZB78tmFWhpN2J50Ok6WeMJhZp1X0xN0EKWxZmRLcYDbCWhyJDe8lgrQKWqdTCMZ5aNEBl9xQUklcC5Gt2jg"
+                        )
                     )
                 )
-            )
-        ));
+            ));
 
         List<Object[]> ret = new ArrayList<>();
-        for (Pair<String, List<Pair<DigestFactory, String>>> kentry : keyEntries) {
-            String keyValue = kentry.getFirst();
+        for (Map.Entry<String, ? extends Collection<? extends Map.Entry<DigestFactory, String>>> kentry : keyEntries) {
+            String keyValue = kentry.getKey();
             try {
                 PublicKey key = PublicKeyEntry.parsePublicKeyEntry(keyValue).resolvePublicKey(PublicKeyEntryResolver.FAILING);
-                for (Pair<DigestFactory, String> dentry : kentry.getSecond()) {
-                    DigestFactory factory = dentry.getFirst();
-                    String fingerprint = dentry.getSecond();
+                for (Map.Entry<DigestFactory, String> dentry : kentry.getValue()) {
+                    DigestFactory factory = dentry.getKey();
+                    String fingerprint = dentry.getValue();
                     if (!factory.isSupported()) {
                         System.out.println("Skip unsupported digest: " + fingerprint);
                         continue;
@@ -143,12 +144,12 @@ public class KeyUtilsFingerprintGenerationTest extends BaseTestSupport {
         );
         assertEquals(
             String.format("Fingerprint check failed for digest %s", name),
-                new Pair<>(true, expected),
+            new SimpleImmutableEntry<>(true, expected),
             KeyUtils.checkFingerPrint(expected, digestFactory, key)
         );
         assertEquals(
             String.format("Fingerprint check succeeded for invalid digest %s", name),
-                new Pair<>(false, expected),
+            new SimpleImmutableEntry<>(false, expected),
             KeyUtils.checkFingerPrint(expected + "A", digestFactory, key)
         );
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 7f2c6aa..ea2be14 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
@@ -28,6 +28,7 @@ import java.nio.file.attribute.PosixFilePermission;
 import java.security.DigestException;
 import java.util.Collection;
 import java.util.Date;
+import java.util.Map;
 
 import org.apache.sshd.common.digest.BaseDigest;
 import org.apache.sshd.common.digest.BuiltinDigests;
@@ -35,7 +36,6 @@ import org.apache.sshd.common.digest.Digest;
 import org.apache.sshd.common.digest.DigestFactory;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.OsUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.io.IoUtils;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.junit.FixMethodOrder;
@@ -135,7 +135,7 @@ public class KeyUtilsTest extends BaseTestSupport {
         if (GenericUtils.isEmpty(perms)) {
             assertNull("Unexpected violation for no permissions file: " + file, KeyUtils.validateStrictKeyFilePermissions(file));
         } else if (OsUtils.isUNIX()) {
-            Pair<String, Object> violation = null;
+            Map.Entry<String, Object> violation = null;
             for (PosixFilePermission p : KeyUtils.STRICTLY_PROHIBITED_FILE_PERMISSION) {
                 if (perms.contains(p)) {
                     violation = KeyUtils.validateStrictKeyFilePermissions(file);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java b/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java
index 996c54e..a2a6436 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java
@@ -23,6 +23,7 @@ import java.io.Flushable;
 import java.net.Socket;
 import java.net.SocketOption;
 import java.nio.channels.AsynchronousSocketChannel;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -36,7 +37,6 @@ import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.io.IoSession;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.session.ServerSessionImpl;
 import org.apache.sshd.server.session.SessionFactory;
@@ -76,7 +76,7 @@ public class Nio2ServiceTest extends BaseTestSupport {
             }
 
             Semaphore sigSem = new Semaphore(0, true);
-            Map<SocketOption<?>, Pair<Object, Object>> actualOptionValues = new HashMap<>(expectedOptions.size());
+            Map<SocketOption<?>, Map.Entry<?, ?>> actualOptionValues = new HashMap<>(expectedOptions.size());
             sshd.setSessionFactory(new SessionFactory(sshd) {
                 @Override
                 protected ServerSessionImpl doCreateSession(IoSession ioSession) throws Exception {
@@ -99,14 +99,14 @@ public class Nio2ServiceTest extends BaseTestSupport {
                     for (Map.Entry<String, ?> oe : expectedOptions.entrySet()) {
                         String propName = oe.getKey();
                         Object expValue = oe.getValue();
-                        Pair<SocketOption<?>, ?> optionEntry = Nio2Service.CONFIGURABLE_OPTIONS.get(propName);
+                        Map.Entry<SocketOption<?>, ?> optionEntry = Nio2Service.CONFIGURABLE_OPTIONS.get(propName);
                         SocketOption<?> option = optionEntry.getKey();
                         if (!supported.contains(option)) {
                             continue;
                         }
 
                         Object actValue = socket.getOption(option);
-                        actualOptionValues.put(option, new Pair<>(expValue, actValue));
+                        actualOptionValues.put(option, new SimpleImmutableEntry<>(expValue, actValue));
                     }
                 }
             });
@@ -123,9 +123,9 @@ public class Nio2ServiceTest extends BaseTestSupport {
             }
 
             // NOTE: we do not fail the test since some O/S implementations treat the value as a recommendation - i.e., they might ignore it
-            for (Map.Entry<SocketOption<?>, Pair<Object, Object>> mme : actualOptionValues.entrySet()) {
+            for (Map.Entry<SocketOption<?>, ? extends Map.Entry<?, ?>> mme : actualOptionValues.entrySet()) {
                 SocketOption<?> option = mme.getKey();
-                Pair<?, ?> vp = mme.getValue();
+                Map.Entry<?, ?> vp = mme.getValue();
                 Object expValue = vp.getKey();
                 Object actValue = vp.getValue();
                 Appendable output = Objects.equals(expValue, actValue) ? System.out : System.err;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 861fdd6..7be4a21 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
@@ -20,16 +20,17 @@
 package org.apache.sshd.common.mac;
 
 import java.nio.charset.StandardCharsets;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.util.test.BaseTestSupport;
@@ -68,78 +69,78 @@ public class MacVectorsTest extends BaseTestSupport {
                     ///////////////// Test Cases for HMAC-MD5 ///////////////////////
                     // see https://tools.ietf.org/html/rfc2202
                     new VectorTestData("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", false, "Hi There",
-                       Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_MD5,     // test case 1
+                       Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_MD5,     // test case 1
                                                 "9294727a3638bb1c13f48ef8158bfc9d"))),
                     new VectorTestData("Jefe", "what do ya want for nothing?",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 2
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 2
                                                  "750c783e6ab0b503eaa86e310a5db738"))),
                     new VectorTestData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", false, repeat("dd", 50), false,
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 3
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 3
                                                  "56be34521d144c88dbb8c733f0e8b3f6"))),
                     /* TODO see why it fails
                     new VectorTestData("0102030405060708090a0b0c0d0e0f10111213141516171819", false, repeat("cd", 50), false,
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 4
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 4
                                                  "697eaf0aca3a3aea3a75164746ffaa79"))),
                     */
                     new VectorTestData("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c", false, "Test With Truncation",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 5
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 5
                                                  "56461ef2342edc00f9bab995690efd4c"),
-                                      new Pair<>(BuiltinMacs.Constants.HMAC_MD5_96,
+                                      new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_MD5_96,
                                                  "56461ef2342edc00f9bab995"))),
                     /* TODO see why it fails
                     new VectorTestData(repeat("aa", 80), false, "Test Using Larger Than Block-Size Key - Hash Key First",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 6
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 6
                                                  "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd"))),
                     */
                     /* TODO see why it fails
                     new VectorTestData(repeat("aa", 80), false, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 7
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_MD5,    // test case 7
                                                  "6f630fad67cda0ee1fb1f562db3aa53e"))),
                     */
                     ///////////////// Test Cases for HMAC-SHA-1 ///////////////////////
                     // see https://tools.ietf.org/html/rfc2202
                     new VectorTestData("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", false, "Hi There",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 1
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 1
                                                  "b617318655057264e28bc0b6fb378c8ef146be00"))),
                     new VectorTestData("Jefe", "what do ya want for nothing?",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 2
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 2
                                                  "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79"))),
                     new VectorTestData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", false, repeat("dd", 50), false,
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 3
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 3
                                                  "125d7342b9ac11cd91a39af48aa17b4f63f175d3"))),
                     /* TODO see why it fails
                     new VectorTestData("0102030405060708090a0b0c0d0e0f10111213141516171819", false, repeat("cd", 50), false,
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 4
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 4
                                                  "4c9007f4026250c6bc8414f9bf50c86c2d7235da"))),
                     */
                     new VectorTestData("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c", false, "Test With Truncation",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 5
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 5
                                                  "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04"),
-                                      new Pair<>(BuiltinMacs.Constants.HMAC_SHA1_96,
+                                      new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1_96,
                                                  "4c1a03424b55e07fe7f27be1"))),
                     /* TODO see why this fails
                     new VectorTestData(repeat("aa", 80), false, "Test Using Larger Than Block-Size Key - Hash Key First",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 6
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 6
                                                  "aa4ae5e15272d00e95705637ce8a3b55ed402112"))),
                     */
 
                     /* TODO see why it fails
                     new VectorTestData(repeat("aa", 80), false, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 7
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 7
                                                  "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04"),
-                                      new Pair<>(BuiltinMacs.Constants.HMAC_SHA1_96,
+                                      new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1_96,
                                                  "4c1a03424b55e07fe7f27be1"))),
                     */
 
                     /* TODO see why it fails
                     new VectorTestData(repeat("aa", 80), false, "Test Using Larger Than Block-Size Key - Hash Key First",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 8
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 8
                                                  "aa4ae5e15272d00e95705637ce8a3b55ed402112"))),
                     */
 
                     /* TODO see why it fails
                     new VectorTestData(repeat("aa", 80), false, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
-                        Arrays.asList(new Pair<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 9
+                        Arrays.asList(new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA1,     // test case 9
                                                  "e8e99d0f45237d786d6bbaa7965c7808bbff1a91"))),
                     */
 
@@ -148,47 +149,47 @@ public class MacVectorsTest extends BaseTestSupport {
                     new VectorTestData(repeat("0b", 20), false, "Hi There",
                        // test case 1
                        Arrays.asList(
-                           new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_256,
+                           new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_256,
                                       "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7"),
-                           new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_512,
+                           new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_512,
                                       "87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854"))),
                     new VectorTestData("Jefe", "what do ya want for nothing?",
                         // test case 2
                         Arrays.asList(
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_256,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_256,
                                        "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843"),
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_512,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_512,
                                        "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737"))),
                     new VectorTestData(repeat("aa", 20), false, repeat("dd", 50), false,
                         // test case 3
                         Arrays.asList(
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_256,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_256,
                                        "773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe"),
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_512,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_512,
                                        "fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb"))),
                     new VectorTestData("0102030405060708090a0b0c0d0e0f10111213141516171819", false, repeat("cd", 50), false,
                         // test case 4
                         Arrays.asList(
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_256,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_256,
                                        "82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b"),
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_512,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_512,
                                        "b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd"))),
 
                     /* TODO see why it fails
                     new VectorTestData(repeat("0c", 20), false, "Test With Truncation",
                         Arrays.asList(   // test case 5
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_256,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_256,
                                        "a3b6167473100ee06e0c796c2955552b"),
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_512,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_512,
                                        "415fad6271580a531d4179bc891d87a6"))),
                     */
 
                     /* TODO see why it fails
                     new VectorTestData(repeat("aa", 131), false, "Test Using Larger Than Block-Size Key - Hash Key First",
                         Arrays.asList(   // test case 6
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_256,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_256,
                                        "60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54"),
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_512,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_512,
                                        "80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598"))),
                     */
 
@@ -198,16 +199,16 @@ public class MacVectorsTest extends BaseTestSupport {
                                                                + " The key needs to be hashed before being used"
                                                                + " by the HMAC algorithm",
                         Arrays.asList(   // test case 7
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_256,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_256,
                                        "9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2"),
-                            new Pair<>(BuiltinMacs.Constants.HMAC_SHA2_512,
+                            new SimpleImmutableEntry<>(BuiltinMacs.Constants.HMAC_SHA2_512,
                                        "e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58")))
                     */
 
                     // mark end
                     new VectorTestData("", false, "", false, Collections.emptyList())))) {
-            for (Pair<String, String> tc : vector.getResults()) {
-                ret.add(new Object[]{vector, tc.getFirst(), tc.getSecond()});
+            for (Map.Entry<String, String> tc : vector.getResults()) {
+                ret.add(new Object[]{vector, tc.getKey(), tc.getValue()});
             }
         }
 
@@ -283,24 +284,24 @@ public class MacVectorsTest extends BaseTestSupport {
     }
 
     private static class VectorTestData extends VectorSeed {
-        private final Collection<Pair<String, String>> results;
+        private final Collection<Map.Entry<String, String>> results;
 
-        VectorTestData(String key, String data, Collection<Pair<String, String>> results) {
+        VectorTestData(String key, String data, Collection<Map.Entry<String, String>> results) {
             super(key, data);
             this.results = results;
         }
 
-        VectorTestData(String key, boolean useKeyString, String data, Collection<Pair<String, String>> results) {
+        VectorTestData(String key, boolean useKeyString, String data, Collection<Map.Entry<String, String>> results) {
             super(key, useKeyString, data);
             this.results = results;
         }
 
-        VectorTestData(String key, boolean useKeyString, String data, boolean useDataString, Collection<Pair<String, String>> results) {
+        VectorTestData(String key, boolean useKeyString, String data, boolean useDataString, Collection<Map.Entry<String, String>> results) {
             super(key, useKeyString, data, useDataString);
             this.results = results;
         }
 
-        public Collection<Pair<String, String>> getResults() {
+        public Collection<Map.Entry<String, String>> getResults() {
             return results;
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 5e966d9..c9850c1 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
@@ -20,8 +20,10 @@
 package org.apache.sshd.common.session;
 
 import java.nio.charset.StandardCharsets;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
@@ -29,7 +31,6 @@ import java.util.concurrent.TimeUnit;
 import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.session.helpers.ReservedSessionMessagesHandlerAdapter;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.server.SshServer;
@@ -165,12 +166,12 @@ public class ReservedSessionMessagesHandlerTest extends BaseTestSupport {
         StringBuilder sb = new StringBuilder(Byte.MAX_VALUE)
                 .append(getClass().getName()).append('#').append(getCurrentTestName()).append("-debug-");
         int sbLen = sb.length();
-        List<Pair<String, Boolean>> expected = new ArrayList<>();
+        List<Map.Entry<String, Boolean>> expected = new ArrayList<>();
         for (int index = 1; index <= Byte.SIZE; index++) {
             sb.setLength(sbLen);
             sb.append(index);
 
-            Pair<String, Boolean> entry = new Pair<>(sb.toString(), (index & 0x01) == 0);
+            Map.Entry<String, Boolean> entry = new SimpleImmutableEntry<>(sb.toString(), (index & 0x01) == 0);
             expected.add(entry);
             session.sendDebugMessage(entry.getValue(), entry.getKey(), null);
         }
@@ -178,12 +179,12 @@ public class ReservedSessionMessagesHandlerTest extends BaseTestSupport {
         assertTrue("Failed to accumulate debug messages on time",
                 handler.waitForDebugCount(expected.size(), TimeUnit.SECONDS, expected.size() * 2));
 
-        List<Pair<String, Boolean>> actual = handler.getDebugMessages();
+        List<? extends Map.Entry<String, Boolean>> actual = handler.getDebugMessages();
         assertEquals("Mismatched size of debug messages", expected.size(), actual.size());
 
         for (int index = 0; index < actual.size(); index++) {
-            Pair<String, Boolean> expEntry = expected.get(index);
-            Pair<String, Boolean> actEntry = actual.get(index);
+            Map.Entry<String, Boolean> expEntry = expected.get(index);
+            Map.Entry<String, Boolean> actEntry = actual.get(index);
             assertEquals("Mismatched debug entry at index " + index, expEntry, actEntry);
         }
     }
@@ -192,7 +193,7 @@ public class ReservedSessionMessagesHandlerTest extends BaseTestSupport {
         private final Semaphore ignoredSignal = new Semaphore(0);
         private final List<byte[]> ignoredMessages = new ArrayList<>();
         private final Semaphore debugSignal = new Semaphore(0);
-        private final List<Pair<String, Boolean>> debugMessages = new ArrayList<>();
+        private final List<SimpleImmutableEntry<String, Boolean>> debugMessages = new ArrayList<>();
 
         public AccumulatingHandler() {
             super();
@@ -213,7 +214,7 @@ public class ReservedSessionMessagesHandlerTest extends BaseTestSupport {
             ignoredSignal.release();
         }
 
-        public List<Pair<String, Boolean>> getDebugMessages() {
+        public List<SimpleImmutableEntry<String, Boolean>> getDebugMessages() {
             return debugMessages;
         }
 
@@ -223,7 +224,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, display));
+            debugMessages.add(new SimpleImmutableEntry<>(msg, display));
             super.handleDebugMessage(session, display, msg, lang, buffer);
             debugSignal.release();
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 7b9ce8e..6f0cb6e 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
@@ -25,10 +25,10 @@ import java.security.Provider;
 import java.security.PublicKey;
 import java.security.spec.RSAPublicKeySpec;
 import java.util.Base64;
+import java.util.Map;
 
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.config.keys.KeyUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.security.SecurityUtils;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.junit.BeforeClass;
@@ -108,9 +108,9 @@ public class SignatureRSATest extends BaseTestSupport {
         assertTrue("Verifier signature size not initialized", vSize > 0);
 
         // make sure padding is required
-        Pair<String, byte[]> encoding = rsa.extractEncodedSignature(TEST_SIGNATURE);
+        Map.Entry<String, byte[]> encoding = rsa.extractEncodedSignature(TEST_SIGNATURE);
         assertNotNull("Signature is not encoded", encoding);
-        byte[] data = encoding.getSecond();
+        byte[] data = encoding.getValue();
         assertTrue("Signature data size (" + data.length + ") not below verifier size (" + vSize + ")", data.length < vSize);
 
         rsa.update(TEST_MSG);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/test/java/org/apache/sshd/common/util/io/ModifiableFileWatcherTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/io/ModifiableFileWatcherTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/io/ModifiableFileWatcherTest.java
index 4caa791..b4871bb 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/io/ModifiableFileWatcherTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/io/ModifiableFileWatcherTest.java
@@ -27,10 +27,10 @@ import java.nio.file.Path;
 import java.nio.file.attribute.PosixFilePermission;
 import java.util.Collection;
 import java.util.Date;
+import java.util.Map;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.OsUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -60,7 +60,7 @@ public class ModifiableFileWatcherTest extends BaseTestSupport {
         if (GenericUtils.isEmpty(perms)) {
             assertNull("Unexpected violation for no permissions file: " + file, ModifiableFileWatcher.validateStrictConfigFilePermissions(file));
         } else if (OsUtils.isUNIX()) {
-            Pair<String, Object> violation = null;
+            Map.Entry<String, Object> violation = null;
             for (PosixFilePermission p : ModifiableFileWatcher.STRICTLY_PROHIBITED_FILE_PERMISSION) {
                 if (perms.contains(p)) {
                     violation = ModifiableFileWatcher.validateStrictConfigFilePermissions(file);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 f72e72f..4281092 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
@@ -21,6 +21,7 @@ package org.apache.sshd.deprecated;
 import java.io.IOException;
 import java.security.PublicKey;
 import java.util.Iterator;
+import java.util.Map;
 
 import org.apache.sshd.agent.SshAgent;
 import org.apache.sshd.client.auth.pubkey.UserAuthPublicKeyFactory;
@@ -28,7 +29,6 @@ import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.client.session.ClientSessionImpl;
 import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.config.keys.KeyUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
 
@@ -39,7 +39,7 @@ import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
 public class UserAuthAgent extends AbstractUserAuth {
 
     private final SshAgent agent;
-    private final Iterator<Pair<PublicKey, String>> keys;
+    private final Iterator<? extends Map.Entry<PublicKey, String>> keys;
 
     public UserAuthAgent(ClientSessionImpl session, String service) throws IOException {
         super(session, service);
@@ -93,7 +93,8 @@ public class UserAuthAgent extends AbstractUserAuth {
     public Result next(Buffer buffer) throws IOException {
         if (buffer == null) {
             if (keys.hasNext()) {
-                sendNextKey(keys.next().getFirst());
+                Map.Entry<PublicKey, String> nextKeyValue = keys.next();
+                sendNextKey(nextKeyValue.getKey());
                 return Result.Continued;
             } else {
                 agent.close();
@@ -113,7 +114,8 @@ public class UserAuthAgent extends AbstractUserAuth {
                     log.debug("Received SSH_MSG_USERAUTH_FAILURE - partial={}, methods={}", partial, methods);
                 }
                 if (keys.hasNext()) {
-                    sendNextKey(keys.next().getFirst());
+                    Map.Entry<PublicKey, String> nextKeyValue = keys.next();
+                    sendNextKey(nextKeyValue.getKey());
                     return Result.Continued;
                 } else {
                     agent.close();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/test/java/org/apache/sshd/util/test/JUnit4SingleInstanceClassRunner.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/JUnit4SingleInstanceClassRunner.java b/sshd-core/src/test/java/org/apache/sshd/util/test/JUnit4SingleInstanceClassRunner.java
index 6b7cb7a..a8f11ce 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/JUnit4SingleInstanceClassRunner.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/JUnit4SingleInstanceClassRunner.java
@@ -18,9 +18,10 @@
  */
 package org.apache.sshd.util.test;
 
+import java.util.AbstractMap.SimpleImmutableEntry;
+import java.util.Map;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.sshd.common.util.Pair;
 import org.junit.runners.BlockJUnit4ClassRunner;
 import org.junit.runners.model.InitializationError;
 import org.junit.runners.model.TestClass;
@@ -30,7 +31,7 @@ import org.junit.runners.model.TestClass;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public class JUnit4SingleInstanceClassRunner extends BlockJUnit4ClassRunner {
-    private final AtomicReference<Pair<Class<?>, Object>> testHolder = new AtomicReference<>();
+    private final AtomicReference<Map.Entry<Class<?>, ?>> testHolder = new AtomicReference<>();
 
     public JUnit4SingleInstanceClassRunner(Class<?> klass) throws InitializationError {
         super(klass);
@@ -38,7 +39,7 @@ public class JUnit4SingleInstanceClassRunner extends BlockJUnit4ClassRunner {
 
     @Override
     protected Object createTest() throws Exception {
-        Pair<Class<?>, Object> lastTest = testHolder.get();
+        Map.Entry<Class<?>, ?> lastTest = testHolder.get();
         Class<?> lastTestClass = (lastTest == null) ? null : lastTest.getKey();
         TestClass curTest = getTestClass();
         Class<?> curTestClass = curTest.getJavaClass();
@@ -47,7 +48,7 @@ public class JUnit4SingleInstanceClassRunner extends BlockJUnit4ClassRunner {
         }
 
         Object instance = super.createTest();
-        testHolder.set(new Pair<>(curTestClass, instance));
+        testHolder.set(new SimpleImmutableEntry<>(curTestClass, instance));
         return instance;
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 3d6f991..51f0884 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
@@ -20,9 +20,11 @@
 package org.apache.sshd.server.auth;
 
 import java.io.File;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
+import java.util.NavigableMap;
 import java.util.Objects;
 import java.util.TreeMap;
 
@@ -51,7 +53,6 @@ import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
 import org.apache.directory.shared.ldap.schema.registries.SchemaLoader;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.Utils;
@@ -69,8 +70,8 @@ public abstract class BaseAuthenticatorTest extends BaseTestSupport {
         super();
     }
 
-    public static String getHost(Pair<LdapServer, DirectoryService> context) {
-        return getHost((context == null) ? null : context.getFirst());
+    public static String getHost(Map.Entry<LdapServer, DirectoryService> context) {
+        return getHost((context == null) ? null : context.getKey());
     }
 
     public static String getHost(LdapServer ldapServer) {
@@ -81,8 +82,8 @@ public abstract class BaseAuthenticatorTest extends BaseTestSupport {
         return GenericUtils.isEmpty(transports) ? null : transports[0].getAddress();
     }
 
-    public static int getPort(Pair<LdapServer, DirectoryService> context) {
-        return getPort((context == null) ? null : context.getFirst());
+    public static int getPort(Map.Entry<LdapServer, DirectoryService> context) {
+        return getPort((context == null) ? null : context.getKey());
     }
 
     public static int getPort(LdapServer ldapServer) {
@@ -97,7 +98,7 @@ public abstract class BaseAuthenticatorTest extends BaseTestSupport {
     // see https://cwiki.apache.org/confluence/display/DIRxSRVx11/4.1.+Embedding+ApacheDS+into+an+application
     // see http://stackoverflow.com/questions/1560230/running-apache-ds-embedded-in-my-application
     @SuppressWarnings("checkstyle:avoidnestedblocks")
-    public static Pair<LdapServer, DirectoryService> startApacheDs(Class<?> anchor) throws Exception {
+    public static SimpleImmutableEntry<LdapServer, DirectoryService> startApacheDs(Class<?> anchor) throws Exception {
         Logger log = LoggerFactory.getLogger(anchor);
         File targetFolder = Objects.requireNonNull(Utils.detectTargetFolder(anchor), "Failed to detect target folder");
         File workingDirectory = assertHierarchyTargetFolderExists(Utils.deleteRecursive(Utils.resolve(targetFolder, anchor.getSimpleName(), "apacheds-work")));
@@ -172,14 +173,14 @@ public abstract class BaseAuthenticatorTest extends BaseTestSupport {
             throw e;
         }
 
-        return new Pair<>(ldapServer, directoryService);
+        return new SimpleImmutableEntry<>(ldapServer, directoryService);
     }
 
     // see http://users.directory.apache.narkive.com/GkyqAkot/how-to-import-ldif-file-programmatically
-    public static Map<String, String> populateUsers(DirectoryService service, Class<?> anchor, String credentialName) throws Exception {
+    public static NavigableMap<String, String> populateUsers(DirectoryService service, Class<?> anchor, String credentialName) throws Exception {
         Logger log = LoggerFactory.getLogger(anchor);
         CoreSession session = Objects.requireNonNull(service.getAdminSession(), "No core session");
-        Map<String, String> usersMap = new TreeMap<>(Comparator.naturalOrder());
+        NavigableMap<String, String> usersMap = new TreeMap<>(Comparator.naturalOrder());
         try (LdifReader reader = new LdifReader(Objects.requireNonNull(anchor.getResourceAsStream("/auth-users.ldif"), "No users ldif"))) {
             int id = 1;
             for (LdifEntry entry : reader) {
@@ -218,9 +219,9 @@ public abstract class BaseAuthenticatorTest extends BaseTestSupport {
         return usersMap;
     }
 
-    public static void stopApacheDs(Pair<LdapServer, DirectoryService> context) throws Exception {
-        stopApacheDs((context == null) ? null : context.getFirst());
-        stopApacheDs((context == null) ? null : context.getSecond());
+    public static void stopApacheDs(Map.Entry<LdapServer, DirectoryService> context) throws Exception {
+        stopApacheDs((context == null) ? null : context.getKey());
+        stopApacheDs((context == null) ? null : context.getValue());
     }
 
     public static void stopApacheDs(LdapServer ldapServer) throws Exception {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/password/LdapPasswordAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/password/LdapPasswordAuthenticatorTest.java b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/password/LdapPasswordAuthenticatorTest.java
index 2dd76b4..a07c543 100644
--- a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/password/LdapPasswordAuthenticatorTest.java
+++ b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/password/LdapPasswordAuthenticatorTest.java
@@ -25,7 +25,6 @@ import java.util.concurrent.atomic.AtomicReference;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.server.auth.BaseAuthenticatorTest;
 import org.apache.sshd.server.session.ServerSession;
 import org.junit.AfterClass;
@@ -40,7 +39,7 @@ import org.mockito.Mockito;
  */
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class LdapPasswordAuthenticatorTest extends BaseAuthenticatorTest {
-    private static final AtomicReference<Pair<LdapServer, DirectoryService>> LDAP_CONTEX_HOLDER = new AtomicReference<>();
+    private static final AtomicReference<Map.Entry<LdapServer, DirectoryService>> LDAP_CONTEX_HOLDER = new AtomicReference<>();
     private static Map<String, String> usersMap;
 
     public LdapPasswordAuthenticatorTest() {
@@ -50,7 +49,7 @@ public class LdapPasswordAuthenticatorTest extends BaseAuthenticatorTest {
     @BeforeClass
     public static void startApacheDs() throws Exception {
         LDAP_CONTEX_HOLDER.set(startApacheDs(LdapPasswordAuthenticatorTest.class));
-        usersMap = populateUsers(LDAP_CONTEX_HOLDER.get().getSecond(), LdapPasswordAuthenticatorTest.class, LdapPasswordAuthenticator.DEFAULT_PASSWORD_ATTR_NAME);
+        usersMap = populateUsers(LDAP_CONTEX_HOLDER.get().getValue(), LdapPasswordAuthenticatorTest.class, LdapPasswordAuthenticator.DEFAULT_PASSWORD_ATTR_NAME);
         assertFalse("No users retrieved", GenericUtils.isEmpty(usersMap));
     }
 
@@ -61,7 +60,7 @@ public class LdapPasswordAuthenticatorTest extends BaseAuthenticatorTest {
 
     @Test   // the user's password is compared with the LDAP stored one
     public void testPasswordComparison() throws Exception {
-        Pair<LdapServer, DirectoryService> ldapContext = LDAP_CONTEX_HOLDER.get();
+        Map.Entry<LdapServer, DirectoryService> ldapContext = LDAP_CONTEX_HOLDER.get();
         LdapPasswordAuthenticator auth = new LdapPasswordAuthenticator();
         auth.setHost(getHost(ldapContext));
         auth.setPort(getPort(ldapContext));

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticatorTest.java b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticatorTest.java
index f2c7b66..b4b66dc 100644
--- a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticatorTest.java
+++ b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticatorTest.java
@@ -32,7 +32,6 @@ import org.apache.sshd.common.config.keys.AuthorizedKeyEntry;
 import org.apache.sshd.common.config.keys.KeyUtils;
 import org.apache.sshd.common.config.keys.PublicKeyEntryResolver;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.server.auth.BaseAuthenticatorTest;
 import org.apache.sshd.server.session.ServerSession;
 import org.junit.AfterClass;
@@ -47,7 +46,7 @@ import org.mockito.Mockito;
  */
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class LdapPublickeyAuthenticatorTest extends BaseAuthenticatorTest {
-    private static final AtomicReference<Pair<LdapServer, DirectoryService>> LDAP_CONTEX_HOLDER = new AtomicReference<>();
+    private static final AtomicReference<Map.Entry<LdapServer, DirectoryService>> LDAP_CONTEX_HOLDER = new AtomicReference<>();
     private static final Map<String, PublicKey> KEYS_MAP = new TreeMap<>(Comparator.naturalOrder());
     // we use this instead of the default since the default requires some extra LDIF manipulation which we don't need
     private static final String TEST_ATTR_NAME = "description";
@@ -60,7 +59,7 @@ public class LdapPublickeyAuthenticatorTest extends BaseAuthenticatorTest {
     public static void startApacheDs() throws Exception {
         LDAP_CONTEX_HOLDER.set(startApacheDs(LdapPublickeyAuthenticatorTest.class));
         Map<String, String> credentials =
-                populateUsers(LDAP_CONTEX_HOLDER.get().getSecond(), LdapPublickeyAuthenticatorTest.class, TEST_ATTR_NAME);
+                populateUsers(LDAP_CONTEX_HOLDER.get().getValue(), LdapPublickeyAuthenticatorTest.class, TEST_ATTR_NAME);
         assertFalse("No keys retrieved", GenericUtils.isEmpty(credentials));
 
         // Cannot use forEach because of the potential GeneraSecurityException being thrown
@@ -79,7 +78,7 @@ public class LdapPublickeyAuthenticatorTest extends BaseAuthenticatorTest {
 
     @Test
     public void testPublicKeyComparison() throws Exception {
-        Pair<LdapServer, DirectoryService> ldapContext = LDAP_CONTEX_HOLDER.get();
+        Map.Entry<LdapServer, DirectoryService> ldapContext = LDAP_CONTEX_HOLDER.get();
         LdapPublickeyAuthenticator auth = new LdapPublickeyAuthenticator();
         auth.setHost(getHost(ldapContext));
         auth.setPort(getPort(ldapContext));


[3/3] mina-sshd git commit: Replaced all usages of Pair with SimpleImmutableEntry (exists since Java 1.6)

Posted by lg...@apache.org.
Replaced all usages of Pair with SimpleImmutableEntry (exists since Java 1.6)


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

Branch: refs/heads/master
Commit: 74b6918bce641e00006510ea38f1dee57fed2b0e
Parents: 1542874
Author: Goldstein Lyor <ly...@c-b4.com>
Authored: Thu Dec 28 12:27:24 2017 +0200
Committer: Goldstein Lyor <ly...@c-b4.com>
Committed: Thu Dec 28 12:42:58 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/sshd/agent/SshAgent.java    |   5 +-
 .../sshd/agent/common/AbstractAgentClient.java  |  12 +-
 .../sshd/agent/common/AbstractAgentProxy.java   |   9 +-
 .../apache/sshd/agent/common/AgentDelegate.java |   4 +-
 .../org/apache/sshd/agent/local/AgentImpl.java  |  25 +++--
 .../auth/hostbased/HostKeyIdentityProvider.java |  11 +-
 .../auth/hostbased/UserAuthHostBased.java       |  10 +-
 .../auth/pubkey/SshAgentPublicKeyIterator.java  |   8 +-
 .../auth/pubkey/UserAuthPublicKeyIterator.java  |  11 +-
 .../DefaultConfigFileHostEntryResolver.java     |   6 +-
 .../config/keys/ClientIdentityFileWatcher.java  |   6 +-
 .../DefaultKnownHostsServerKeyVerifier.java     |   6 +-
 .../extensions/CheckFileHandleExtension.java    |   8 +-
 .../sftp/extensions/CheckFileNameExtension.java |   9 +-
 .../helpers/AbstractCheckFileExtension.java     |   6 +-
 .../helpers/CheckFileHandleExtensionImpl.java   |   6 +-
 .../helpers/CheckFileNameExtensionImpl.java     |   6 +-
 .../apache/sshd/common/SyspropsMapWrapper.java  |   8 +-
 .../sshd/common/config/keys/KeyUtils.java       |  40 +++----
 .../loader/AbstractKeyPairResourceParser.java   |   4 +-
 .../keys/loader/KeyPairResourceParser.java      |  12 +-
 .../openssh/OpenSSHKeyPairResourceParser.java   |   8 +-
 .../pem/ECDSAPEMResourceKeyPairParser.java      |  15 +--
 .../apache/sshd/common/io/nio2/Nio2Service.java |  23 ++--
 .../common/session/helpers/AbstractSession.java |  34 +++---
 .../common/signature/AbstractSignature.java     |   8 +-
 .../sshd/common/signature/SignatureDSA.java     |   8 +-
 .../sshd/common/signature/SignatureECDSA.java   |   8 +-
 .../sshd/common/signature/SignatureRSA.java     |   8 +-
 .../org/apache/sshd/common/util/Invoker.java    |  12 +-
 .../apache/sshd/common/util/MapEntryUtils.java  |  53 +++++++++
 .../java/org/apache/sshd/common/util/Pair.java  | 109 -------------------
 .../common/util/io/ModifiableFileWatcher.java   |  12 +-
 .../util/security/eddsa/SignatureEd25519.java   |   9 +-
 .../DefaultAuthorizedKeysAuthenticator.java     |   6 +-
 .../sftp/AbstractSftpSubsystemHelper.java       |  22 ++--
 .../java/org/apache/sshd/agent/AgentTest.java   |   4 +-
 .../helpers/AbstractCheckFileExtensionTest.java |  16 +--
 .../KeyUtilsFingerprintCaseSensitivityTest.java |   4 +-
 .../keys/KeyUtilsFingerprintGenerationTest.java | 105 +++++++++---------
 .../sshd/common/config/keys/KeyUtilsTest.java   |   4 +-
 .../sshd/common/io/nio2/Nio2ServiceTest.java    |  12 +-
 .../apache/sshd/common/mac/MacVectorsTest.java  |  83 +++++++-------
 .../ReservedSessionMessagesHandlerTest.java     |  19 ++--
 .../sshd/common/signature/SignatureRSATest.java |   6 +-
 .../util/io/ModifiableFileWatcherTest.java      |   4 +-
 .../apache/sshd/deprecated/UserAuthAgent.java   |  10 +-
 .../test/JUnit4SingleInstanceClassRunner.java   |   9 +-
 .../sshd/server/auth/BaseAuthenticatorTest.java |  25 +++--
 .../password/LdapPasswordAuthenticatorTest.java |   7 +-
 .../pubkey/LdapPublickeyAuthenticatorTest.java  |   7 +-
 51 files changed, 411 insertions(+), 451 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/agent/SshAgent.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/SshAgent.java b/sshd-core/src/main/java/org/apache/sshd/agent/SshAgent.java
index 83e2aa0..dc5b832 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/SshAgent.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/SshAgent.java
@@ -22,8 +22,7 @@ import java.io.IOException;
 import java.security.KeyPair;
 import java.security.PublicKey;
 import java.util.List;
-
-import org.apache.sshd.common.util.Pair;
+import java.util.Map;
 
 /**
  * SSH key agent server
@@ -32,7 +31,7 @@ public interface SshAgent extends java.nio.channels.Channel {
 
     String SSH_AUTHSOCKET_ENV_NAME = "SSH_AUTH_SOCK";
 
-    List<Pair<PublicKey, String>> getIdentities() throws IOException;
+    List<? extends Map.Entry<PublicKey, String>> getIdentities() throws IOException;
 
     byte[] sign(PublicKey key, byte[] data) throws IOException;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 dd007db..c4c3f26 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
@@ -21,12 +21,12 @@ package org.apache.sshd.agent.common;
 import java.io.IOException;
 import java.security.KeyPair;
 import java.security.PublicKey;
-import java.util.List;
+import java.util.Collection;
+import java.util.Map;
 
 import org.apache.sshd.agent.SshAgent;
 import org.apache.sshd.agent.SshAgentConstants;
 import org.apache.sshd.common.config.keys.KeyUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.BufferUtils;
@@ -96,12 +96,12 @@ public abstract class AbstractAgentClient extends AbstractLoggingBean {
         }
         switch (cmd) {
             case SshAgentConstants.SSH2_AGENTC_REQUEST_IDENTITIES: {
-                List<Pair<PublicKey, String>> keys = agent.getIdentities();
+                Collection<? extends Map.Entry<PublicKey, String>> keys = agent.getIdentities();
                 rep.putByte(SshAgentConstants.SSH2_AGENT_IDENTITIES_ANSWER);
                 rep.putInt(keys.size());
-                for (Pair<PublicKey, String> key : keys) {
-                    rep.putPublicKey(key.getFirst());
-                    rep.putString(key.getSecond());
+                for (Map.Entry<PublicKey, String> key : keys) {
+                    rep.putPublicKey(key.getKey());
+                    rep.putString(key.getValue());
                 }
                 break;
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java b/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java
index 21bd92c..c2d8365 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java
@@ -21,9 +21,11 @@ package org.apache.sshd.agent.common;
 import java.io.IOException;
 import java.security.KeyPair;
 import java.security.PublicKey;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 
 import org.apache.sshd.agent.SshAgent;
@@ -32,7 +34,6 @@ import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.SshException;
 import org.apache.sshd.common.config.keys.KeyUtils;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
@@ -81,7 +82,7 @@ public abstract class AbstractAgentProxy extends AbstractLoggingBean implements
     }
 
     @Override
-    public List<Pair<PublicKey, String>> getIdentities() throws IOException {
+    public List<? extends Map.Entry<PublicKey, String>> getIdentities() throws IOException {
         int cmd = SshAgentConstants.SSH2_AGENTC_REQUEST_IDENTITIES;
         int okcmd = SshAgentConstants.SSH2_AGENT_IDENTITIES_ANSWER;
         if (FactoryManager.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) {
@@ -101,7 +102,7 @@ public abstract class AbstractAgentProxy extends AbstractLoggingBean implements
             throw new SshException("Bad identities count: " + nbIdentities);
         }
 
-        List<Pair<PublicKey, String>> keys = new ArrayList<>(nbIdentities);
+        List<SimpleImmutableEntry<PublicKey, String>> keys = new ArrayList<>(nbIdentities);
         for (int i = 0; i < nbIdentities; i++) {
             PublicKey key = buffer.getPublicKey();
             String comment = buffer.getString();
@@ -109,7 +110,7 @@ public abstract class AbstractAgentProxy extends AbstractLoggingBean implements
                 log.debug("getIdentities() key type={}, comment={}, fingerprint={}",
                           KeyUtils.getKeyType(key), comment, KeyUtils.getFingerPrint(key));
             }
-            keys.add(new Pair<>(key, comment));
+            keys.add(new SimpleImmutableEntry<>(key, comment));
         }
 
         return keys;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/agent/common/AgentDelegate.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/common/AgentDelegate.java b/sshd-core/src/main/java/org/apache/sshd/agent/common/AgentDelegate.java
index 24bb0eb..1bd9704 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/common/AgentDelegate.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/common/AgentDelegate.java
@@ -22,9 +22,9 @@ import java.io.IOException;
 import java.security.KeyPair;
 import java.security.PublicKey;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.sshd.agent.SshAgent;
-import org.apache.sshd.common.util.Pair;
 
 public class AgentDelegate implements SshAgent {
 
@@ -45,7 +45,7 @@ public class AgentDelegate implements SshAgent {
     }
 
     @Override
-    public List<Pair<PublicKey, String>> getIdentities() throws IOException {
+    public List<? extends Map.Entry<PublicKey, String>> getIdentities() throws IOException {
         return agent.getIdentities();
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 b1c8602..eeffb98 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
@@ -25,9 +25,11 @@ import java.security.interfaces.DSAPublicKey;
 import java.security.interfaces.ECPublicKey;
 import java.security.interfaces.RSAPublicKey;
 import java.security.spec.InvalidKeySpecException;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -37,7 +39,6 @@ import org.apache.sshd.common.config.keys.KeyUtils;
 import org.apache.sshd.common.signature.BuiltinSignatures;
 import org.apache.sshd.common.signature.Signature;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.security.SecurityUtils;
 
@@ -46,7 +47,7 @@ import org.apache.sshd.common.util.security.SecurityUtils;
  */
 public class AgentImpl implements SshAgent {
 
-    private final List<Pair<KeyPair, String>> keys = new ArrayList<>();
+    private final List<Map.Entry<KeyPair, String>> keys = new ArrayList<>();
     private final AtomicBoolean open = new AtomicBoolean(true);
 
     public AgentImpl() {
@@ -59,12 +60,12 @@ public class AgentImpl implements SshAgent {
     }
 
     @Override
-    public List<Pair<PublicKey, String>> getIdentities() throws IOException {
+    public List<? extends Map.Entry<PublicKey, String>> getIdentities() throws IOException {
         if (!isOpen()) {
             throw new SshException("Agent closed");
         }
 
-        return GenericUtils.map(keys, kp -> new Pair<>(kp.getFirst().getPublic(), kp.getSecond()));
+        return GenericUtils.map(keys, kp -> new SimpleImmutableEntry<>(kp.getKey().getPublic(), kp.getValue()));
     }
 
     @Override
@@ -74,9 +75,9 @@ public class AgentImpl implements SshAgent {
         }
 
         try {
-            Pair<KeyPair, String> pp = Objects.requireNonNull(getKeyPair(keys, key), "Key not found");
-            KeyPair kp = ValidateUtils.checkNotNull(pp.getFirst(), "No key pair for agent=%s", pp.getSecond());
-            PublicKey pubKey = ValidateUtils.checkNotNull(kp.getPublic(), "No public key for agent=%s", pp.getSecond());
+            Map.Entry<KeyPair, String> pp = Objects.requireNonNull(getKeyPair(keys, key), "Key not found");
+            KeyPair kp = ValidateUtils.checkNotNull(pp.getKey(), "No key pair for agent=%s", pp.getValue());
+            PublicKey pubKey = ValidateUtils.checkNotNull(kp.getPublic(), "No public key for agent=%s", pp.getValue());
 
             final Signature verif;
             if (pubKey instanceof DSAPublicKey) {
@@ -106,7 +107,7 @@ public class AgentImpl implements SshAgent {
         if (!isOpen()) {
             throw new SshException("Agent closed");
         }
-        keys.add(new Pair<>(Objects.requireNonNull(key, "No key"), comment));
+        keys.add(new SimpleImmutableEntry<>(Objects.requireNonNull(key, "No key"), comment));
     }
 
     @Override
@@ -115,7 +116,7 @@ public class AgentImpl implements SshAgent {
             throw new SshException("Agent closed");
         }
 
-        Pair<KeyPair, String> kp = getKeyPair(keys, key);
+        Map.Entry<KeyPair, String> kp = getKeyPair(keys, key);
         if (kp == null) {
             throw new SshException("Key not found");
         }
@@ -137,13 +138,13 @@ public class AgentImpl implements SshAgent {
         }
     }
 
-    protected static Pair<KeyPair, String> getKeyPair(Collection<Pair<KeyPair, String>> keys, PublicKey key) {
+    protected static Map.Entry<KeyPair, String> getKeyPair(Collection<? extends Map.Entry<KeyPair, String>> keys, PublicKey key) {
         if (GenericUtils.isEmpty(keys) || (key == null)) {
             return null;
         }
 
-        for (Pair<KeyPair, String> k : keys) {
-            KeyPair kp = k.getFirst();
+        for (Map.Entry<KeyPair, String> k : keys) {
+            KeyPair kp = k.getKey();
             if (KeyUtils.compareKeys(key, kp.getPublic())) {
                 return k;
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 b141eb5..85bb82c 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,12 +21,13 @@ package org.apache.sshd.client.auth.hostbased;
 
 import java.security.KeyPair;
 import java.security.cert.X509Certificate;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
@@ -34,11 +35,11 @@ import org.apache.sshd.common.util.Pair;
 @FunctionalInterface
 public interface HostKeyIdentityProvider {
     /**
-     * @return The host keys as a {@link Pair} of key + certificates (which can be {@code null}/empty)
+     * @return The host keys as a {@link Map.Entry} of key + certificates (which can be {@code null}/empty)
      */
-    Iterable<Pair<KeyPair, List<X509Certificate>>> loadHostKeys();
+    Iterable<? extends Map.Entry<KeyPair, List<X509Certificate>>> loadHostKeys();
 
-    static Iterator<Pair<KeyPair, List<X509Certificate>>> iteratorOf(HostKeyIdentityProvider provider) {
+    static Iterator<? extends Map.Entry<KeyPair, List<X509Certificate>>> iteratorOf(HostKeyIdentityProvider provider) {
         return GenericUtils.iteratorOf((provider == null) ? null : provider.loadHostKeys());
     }
 
@@ -47,6 +48,6 @@ public interface HostKeyIdentityProvider {
     }
 
     static HostKeyIdentityProvider wrap(Iterable<? extends KeyPair> pairs) {
-        return () -> GenericUtils.wrapIterable(pairs, kp -> new Pair<>(kp, Collections.<X509Certificate>emptyList()));
+        return () -> GenericUtils.wrapIterable(pairs, kp -> new SimpleImmutableEntry<>(kp, Collections.<X509Certificate>emptyList()));
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 398cc4c..c363eeb 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
@@ -25,6 +25,7 @@ import java.security.cert.X509Certificate;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.sshd.client.auth.AbstractUserAuth;
 import org.apache.sshd.client.session.ClientSession;
@@ -35,7 +36,6 @@ import org.apache.sshd.common.signature.Signature;
 import org.apache.sshd.common.signature.SignatureFactoriesManager;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.OsUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.BufferUtils;
@@ -48,7 +48,7 @@ import org.apache.sshd.common.util.net.SshdSocketAddress;
 public class UserAuthHostBased extends AbstractUserAuth implements SignatureFactoriesManager {
     public static final String NAME = UserAuthHostBasedFactory.NAME;
 
-    private Iterator<Pair<KeyPair, List<X509Certificate>>> keys;
+    private Iterator<? extends Map.Entry<KeyPair, ? extends Collection<X509Certificate>>> keys;
     private final HostKeyIdentityProvider clientHostKeys;
     private List<NamedFactory<Signature>> factories;
     private String clientUsername;
@@ -102,8 +102,8 @@ public class UserAuthHostBased extends AbstractUserAuth implements SignatureFact
             return false;
         }
 
-        Pair<KeyPair, List<X509Certificate>> keyInfo = keys.next();
-        KeyPair kp = keyInfo.getFirst();
+        Map.Entry<KeyPair, ? extends Collection<X509Certificate>> keyInfo = keys.next();
+        KeyPair kp = keyInfo.getKey();
         PublicKey pub = kp.getPublic();
         String keyType = KeyUtils.getKeyType(pub);
         if (log.isTraceEnabled()) {
@@ -137,7 +137,7 @@ public class UserAuthHostBased extends AbstractUserAuth implements SignatureFact
 
         buffer.putRawPublicKey(pub);
 
-        List<X509Certificate> certs = keyInfo.getSecond();
+        Collection<X509Certificate> certs = keyInfo.getValue();
         if (GenericUtils.size(certs) > 0) {
             for (X509Certificate c : certs) {
                 // TODO make sure this yields DER encoding

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/SshAgentPublicKeyIterator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/SshAgentPublicKeyIterator.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/SshAgentPublicKeyIterator.java
index 315e245..7551ed8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/SshAgentPublicKeyIterator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/SshAgentPublicKeyIterator.java
@@ -22,19 +22,19 @@ package org.apache.sshd.client.auth.pubkey;
 import java.io.IOException;
 import java.security.PublicKey;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.Objects;
 
 import org.apache.sshd.agent.SshAgent;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public class SshAgentPublicKeyIterator extends AbstractKeyPairIterator<KeyAgentIdentity> {
     private final SshAgent agent;
-    private final Iterator<Pair<PublicKey, String>> keys;
+    private final Iterator<? extends Map.Entry<PublicKey, String>> keys;
 
     public SshAgentPublicKeyIterator(ClientSession session, SshAgent agent) throws IOException {
         super(session);
@@ -49,7 +49,7 @@ public class SshAgentPublicKeyIterator extends AbstractKeyPairIterator<KeyAgentI
 
     @Override
     public KeyAgentIdentity next() {
-        Pair<PublicKey, String> kp = keys.next();
-        return new KeyAgentIdentity(agent, kp.getFirst(), kp.getSecond());
+        Map.Entry<PublicKey, String> kp = keys.next();
+        return new KeyAgentIdentity(agent, kp.getKey(), kp.getValue());
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 1d36cce..202b0a8 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
@@ -56,8 +56,9 @@ public class UserAuthPublicKeyIterator extends AbstractKeyPairIterator<PublicKey
         if (factory != null) {
             try {
                 agent = Objects.requireNonNull(factory.createClient(manager), "No agent created");
-                identities.add(agent.getIdentities().stream()
-                        .map(kp -> new KeyAgentIdentity(agent, kp.getFirst(), kp.getSecond())));
+                identities.add(agent.getIdentities()
+                    .stream()
+                    .map(kp -> new KeyAgentIdentity(agent, kp.getKey(), kp.getValue())));
             } catch (Exception e) {
                 try {
                     closeAgent();
@@ -70,9 +71,9 @@ public class UserAuthPublicKeyIterator extends AbstractKeyPairIterator<PublicKey
         }
 
         identities.add(Stream.of(KeyIdentityProvider.providerOf(session))
-                .map(KeyIdentityProvider::loadKeys)
-                .flatMap(GenericUtils::stream)
-                .map(kp -> new KeyPairIdentity(signatureFactories, session, kp)));
+            .map(KeyIdentityProvider::loadKeys)
+            .flatMap(GenericUtils::stream)
+            .map(kp -> new KeyPairIdentity(signatureFactories, session, kp)));
 
         current = identities.stream().flatMap(r -> r).iterator();
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java
index b03225c..da5f687 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java
@@ -25,9 +25,9 @@ import java.nio.file.LinkOption;
 import java.nio.file.Path;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.io.IoUtils;
 
 /**
@@ -81,10 +81,10 @@ public class DefaultConfigFileHostEntryResolver extends ConfigFileHostEntryResol
                 log.debug("reloadHostConfigEntries({}@{}:{}) check permissions of {}", username, host, port, path);
             }
 
-            Pair<String, Object> violation = validateStrictConfigFilePermissions(path);
+            Map.Entry<String, ?> violation = validateStrictConfigFilePermissions(path);
             if (violation != null) {
                 log.warn("reloadHostConfigEntries({}@{}:{}) invalid file={} permissions: {}",
-                         username, host, port, path, violation.getFirst());
+                         username, host, port, path, violation.getKey());
                 updateReloadAttributes();
                 return Collections.emptyList();
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentityFileWatcher.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentityFileWatcher.java b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentityFileWatcher.java
index a051606..a00cb24 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentityFileWatcher.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentityFileWatcher.java
@@ -24,6 +24,7 @@ import java.nio.file.Path;
 import java.security.GeneralSecurityException;
 import java.security.KeyPair;
 import java.security.PublicKey;
+import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Supplier;
@@ -31,7 +32,6 @@ import java.util.function.Supplier;
 import org.apache.sshd.common.config.keys.FilePasswordProvider;
 import org.apache.sshd.common.config.keys.KeyUtils;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.io.IoUtils;
 import org.apache.sshd.common.util.io.ModifiableFileWatcher;
 
@@ -105,10 +105,10 @@ public class ClientIdentityFileWatcher extends ModifiableFileWatcher implements
 
     protected KeyPair reloadClientIdentity(Path path) throws IOException, GeneralSecurityException {
         if (isStrict()) {
-            Pair<String, Object> violation = KeyUtils.validateStrictKeyFilePermissions(path, IoUtils.EMPTY_LINK_OPTIONS);
+            Map.Entry<String, Object> violation = KeyUtils.validateStrictKeyFilePermissions(path, IoUtils.EMPTY_LINK_OPTIONS);
             if (violation != null) {
                 if (log.isDebugEnabled()) {
-                    log.debug("reloadClientIdentity({}) ignore due to {}", path, violation.getFirst());
+                    log.debug("reloadClientIdentity({}) ignore due to {}", path, violation.getKey());
                 }
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DefaultKnownHostsServerKeyVerifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DefaultKnownHostsServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DefaultKnownHostsServerKeyVerifier.java
index f2f83ad..b1c3a10 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DefaultKnownHostsServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DefaultKnownHostsServerKeyVerifier.java
@@ -26,10 +26,10 @@ import java.nio.file.Path;
 import java.security.GeneralSecurityException;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
 import org.apache.sshd.client.config.hosts.KnownHostEntry;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.io.IoUtils;
 
 /**
@@ -76,9 +76,9 @@ public class DefaultKnownHostsServerKeyVerifier extends KnownHostsServerKeyVerif
                 log.debug("reloadKnownHosts({}) check permissions", file);
             }
 
-            Pair<String, Object> violation = validateStrictConfigFilePermissions(file);
+            Map.Entry<String, ?> violation = validateStrictConfigFilePermissions(file);
             if (violation != null) {
-                log.warn("reloadKnownHosts({}) invalid file permissions: {}", file, violation.getFirst());
+                log.warn("reloadKnownHosts({}) invalid file permissions: {}", file, violation.getKey());
                 updateReloadAttributes();
                 return Collections.emptyList();
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileHandleExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileHandleExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileHandleExtension.java
index c5208c5..e788bf8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileHandleExtension.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileHandleExtension.java
@@ -21,9 +21,9 @@ package org.apache.sshd.client.subsystem.sftp.extensions;
 
 import java.io.IOException;
 import java.util.Collection;
+import java.util.Map;
 
 import org.apache.sshd.client.subsystem.sftp.SftpClient.Handle;
-import org.apache.sshd.common.util.Pair;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
@@ -37,10 +37,10 @@ public interface CheckFileHandleExtension extends SftpClientExtension {
      * @param length      Length of data to hash - if zero then till EOF
      * @param blockSize   Input block size to calculate individual hashes - if
      *                    zero the <U>one</U> hash of <U>all</U> the data
-     * @return A {@link Pair} where left=hash algorithm name, right=the calculated
-     * hashes.
+     * @return An <U>immutable</U> {@link Map.Entry} where key=hash algorithm name,
+     * value=the calculated hashes.
      * @throws IOException If failed to execute the command
      */
-    Pair<String, Collection<byte[]>> checkFileHandle(Handle handle, Collection<String> algorithms, long startOffset, long length, int blockSize) throws IOException;
+    Map.Entry<String, Collection<byte[]>> checkFileHandle(Handle handle, Collection<String> algorithms, long startOffset, long length, int blockSize) throws IOException;
 
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileNameExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileNameExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileNameExtension.java
index e4ff1e9..8f562ba 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileNameExtension.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/CheckFileNameExtension.java
@@ -21,8 +21,7 @@ package org.apache.sshd.client.subsystem.sftp.extensions;
 
 import java.io.IOException;
 import java.util.Collection;
-
-import org.apache.sshd.common.util.Pair;
+import java.util.Map;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
@@ -36,9 +35,9 @@ public interface CheckFileNameExtension extends SftpClientExtension {
      * @param length      Length of data to hash - if zero then till EOF
      * @param blockSize   Input block size to calculate individual hashes - if
      *                    zero the <U>one</U> hash of <U>all</U> the data
-     * @return A {@link Pair} where left=hash algorithm name, right=the calculated
-     * hashes.
+     * @return An <U>immutable</U> {@link Map.Entry} key left=hash algorithm name,
+     * value=the calculated hashes.
      * @throws IOException If failed to execute the command
      */
-    Pair<String, Collection<byte[]>> checkFileName(String name, Collection<String> algorithms, long startOffset, long length, int blockSize) throws IOException;
+    Map.Entry<String, Collection<byte[]>> checkFileName(String name, Collection<String> algorithms, long startOffset, long length, int blockSize) throws IOException;
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 640f5c0..1411098 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
@@ -21,6 +21,7 @@ package org.apache.sshd.client.subsystem.sftp.extensions.helpers;
 
 import java.io.IOException;
 import java.io.StreamCorruptedException;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
 import java.util.LinkedList;
 
@@ -28,7 +29,6 @@ import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
 import org.apache.sshd.client.subsystem.sftp.SftpClient;
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 
@@ -40,7 +40,7 @@ public abstract class AbstractCheckFileExtension extends AbstractSftpClientExten
         super(name, client, raw, extras);
     }
 
-    protected Pair<String, Collection<byte[]>> doGetHash(Object target, Collection<String> algorithms, long offset, long length, int blockSize) throws IOException {
+    protected SimpleImmutableEntry<String, Collection<byte[]>> doGetHash(Object target, Collection<String> algorithms, long offset, long length, int blockSize) throws IOException {
         Buffer buffer = getCommandBuffer(target, Byte.MAX_VALUE);
         putTarget(buffer, target);
         buffer.putString(GenericUtils.join(algorithms, ','));
@@ -71,6 +71,6 @@ public abstract class AbstractCheckFileExtension extends AbstractSftpClientExten
             hashes.add(hashValue);
         }
 
-        return new Pair<>(algo, hashes);
+        return new SimpleImmutableEntry<>(algo, hashes);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileHandleExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileHandleExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileHandleExtensionImpl.java
index 65e6b54..1a464c3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileHandleExtensionImpl.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileHandleExtensionImpl.java
@@ -20,6 +20,7 @@
 package org.apache.sshd.client.subsystem.sftp.extensions.helpers;
 
 import java.io.IOException;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
 
 import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
@@ -27,7 +28,6 @@ import org.apache.sshd.client.subsystem.sftp.SftpClient;
 import org.apache.sshd.client.subsystem.sftp.SftpClient.Handle;
 import org.apache.sshd.client.subsystem.sftp.extensions.CheckFileHandleExtension;
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-import org.apache.sshd.common.util.Pair;
 
 /**
  * Implements &quot;check-file-handle&quot; extension
@@ -41,7 +41,9 @@ public class CheckFileHandleExtensionImpl extends AbstractCheckFileExtension imp
     }
 
     @Override
-    public Pair<String, Collection<byte[]>> checkFileHandle(Handle handle, Collection<String> algorithms, long startOffset, long length, int blockSize) throws IOException {
+    public SimpleImmutableEntry<String, Collection<byte[]>> checkFileHandle(
+            Handle handle, Collection<String> algorithms, long startOffset, long length, int blockSize)
+                throws IOException {
         return doGetHash(handle.getIdentifier(), algorithms, startOffset, length, blockSize);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileNameExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileNameExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileNameExtensionImpl.java
index 77c4af3..1b615c8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileNameExtensionImpl.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileNameExtensionImpl.java
@@ -20,13 +20,13 @@
 package org.apache.sshd.client.subsystem.sftp.extensions.helpers;
 
 import java.io.IOException;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
 
 import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
 import org.apache.sshd.client.subsystem.sftp.SftpClient;
 import org.apache.sshd.client.subsystem.sftp.extensions.CheckFileNameExtension;
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-import org.apache.sshd.common.util.Pair;
 
 /**
  * Implements &quot;check-file-name&quot; extension
@@ -40,7 +40,9 @@ public class CheckFileNameExtensionImpl extends AbstractCheckFileExtension imple
     }
 
     @Override
-    public Pair<String, Collection<byte[]>> checkFileName(String name, Collection<String> algorithms, long startOffset, long length, int blockSize) throws IOException {
+    public SimpleImmutableEntry<String, Collection<byte[]>> checkFileName(
+            String name, Collection<String> algorithms, long startOffset, long length, int blockSize)
+                throws IOException {
         return doGetHash(name, algorithms, startOffset, length, blockSize);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 6dcb615..4408be2 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,6 +19,7 @@
 
 package org.apache.sshd.common;
 
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
 import java.util.Map;
 import java.util.Objects;
@@ -28,7 +29,7 @@ import java.util.TreeSet;
 import java.util.stream.Collectors;
 
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
+import org.apache.sshd.common.util.MapEntryUtils;
 
 /**
  * A wrapper that exposes a read-only {@link Map} access to the system
@@ -105,8 +106,7 @@ public final class SyspropsMapWrapper implements Map<String, Object> {
     public Set<Entry<String, Object>> entrySet() {
         Properties props = System.getProperties();
         // return a copy in order to avoid concurrent modifications
-        Set<Entry<String, Object>> entries =
-                new TreeSet<>(Pair.byKeyEntryComparator());
+        Set<Entry<String, Object>> entries = new TreeSet<>(MapEntryUtils.byKeyEntryComparator());
         for (String key : props.stringPropertyNames()) {
             if (!isMappedSyspropKey(key)) {
                 continue;
@@ -114,7 +114,7 @@ public final class SyspropsMapWrapper implements Map<String, Object> {
 
             Object v = props.getProperty(key);
             if (v != null) {
-                entries.add(new Pair<>(getUnmappedSyspropKey(key), v));
+                entries.add(new SimpleImmutableEntry<>(getUnmappedSyspropKey(key), v));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 6ff6fde..84b019f 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
@@ -47,6 +47,7 @@ import java.security.spec.DSAPublicKeySpec;
 import java.security.spec.ECParameterSpec;
 import java.security.spec.InvalidKeySpecException;
 import java.security.spec.RSAPublicKeySpec;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -71,7 +72,6 @@ import org.apache.sshd.common.digest.DigestUtils;
 import org.apache.sshd.common.keyprovider.KeyPairProvider;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.OsUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
@@ -186,13 +186,13 @@ public final class KeyUtils {
      * @param path    The {@link Path} to be checked - ignored if {@code null}
      *                or does not exist
      * @param options The {@link LinkOption}s to use to query the file's permissions
-     * @return The violated permission as {@link Pair} first is a message second is
-     * offending object {@link PosixFilePermission} or {@link String} for owner - {@code null} if
-     * no violations detected
+     * @return The violated permission as {@link SimpleImmutableEntry} where key is a message and
+     * value is the offending object {@link PosixFilePermission} or {@link String} for owner - {@code null}
+     * if no violations detected
      * @throws IOException If failed to retrieve the permissions
      * @see #STRICTLY_PROHIBITED_FILE_PERMISSION
      */
-    public static Pair<String, Object> validateStrictKeyFilePermissions(Path path, LinkOption... options) throws IOException {
+    public static SimpleImmutableEntry<String, Object> validateStrictKeyFilePermissions(Path path, LinkOption... options) throws IOException {
         if ((path == null) || (!Files.exists(path, options))) {
             return null;
         }
@@ -204,20 +204,20 @@ public final class KeyUtils {
 
         if (perms.contains(PosixFilePermission.OTHERS_EXECUTE)) {
             PosixFilePermission p = PosixFilePermission.OTHERS_EXECUTE;
-            return new Pair<>(String.format("Permissions violation (%s)", p), p);
+            return new SimpleImmutableEntry<>(String.format("Permissions violation (%s)", p), p);
         }
 
         if (OsUtils.isUNIX()) {
             PosixFilePermission p = IoUtils.validateExcludedPermissions(perms, STRICTLY_PROHIBITED_FILE_PERMISSION);
             if (p != null) {
-                return new Pair<>(String.format("Permissions violation (%s)", p), p);
+                return new SimpleImmutableEntry<>(String.format("Permissions violation (%s)", p), p);
             }
 
             if (Files.isRegularFile(path, options)) {
                 Path parent = path.getParent();
                 p = IoUtils.validateExcludedPermissions(IoUtils.getPermissions(parent, options), STRICTLY_PROHIBITED_FILE_PERMISSION);
                 if (p != null) {
-                    return new Pair<>(String.format("Parent permissions violation (%s)", p), p);
+                    return new SimpleImmutableEntry<>(String.format("Parent permissions violation (%s)", p), p);
                 }
             }
         }
@@ -239,14 +239,14 @@ public final class KeyUtils {
         }
 
         if (!expected.contains(owner)) {
-            return new Pair<>(String.format("Owner violation (%s)", owner), owner);
+            return new SimpleImmutableEntry<>(String.format("Owner violation (%s)", owner), owner);
         }
 
         if (OsUtils.isUNIX()) {
             if (Files.isRegularFile(path, options)) {
                 String parentOwner = IoUtils.getFileOwner(path.getParent(), options);
                 if ((!GenericUtils.isEmpty(parentOwner)) && (!expected.contains(parentOwner))) {
-                    return new Pair<>(String.format("Parent owner violation (%s)", parentOwner), parentOwner);
+                    return new SimpleImmutableEntry<>(String.format("Parent owner violation (%s)", parentOwner), parentOwner);
                 }
             }
         }
@@ -581,12 +581,12 @@ public final class KeyUtils {
      * @param expected The expected fingerprint if {@code null} or empty then returns a failure
      * with the default fingerprint.
      * @param key the {@link PublicKey} - if {@code null} then returns null.
-     * @return Pair<Boolean, String> - first is success indicator, second is actual fingerprint,
+     * @return SimpleImmutableEntry<Boolean, String> - key is success indicator, value is actual fingerprint,
      * {@code null} if no key.
      * @see #getDefaultFingerPrintFactory()
      * @see #checkFingerPrint(String, Factory, PublicKey)
      */
-    public static Pair<Boolean, String> checkFingerPrint(String expected, PublicKey key) {
+    public static SimpleImmutableEntry<Boolean, String> checkFingerPrint(String expected, PublicKey key) {
         return checkFingerPrint(expected, getDefaultFingerPrintFactory(), key);
     }
 
@@ -595,10 +595,10 @@ public final class KeyUtils {
      * with the default fingerprint.
      * @param f The {@link Factory} to be used to generate the default {@link Digest} for the key
      * @param key the {@link PublicKey} - if {@code null} then returns null.
-     * @return Pair<Boolean, String> - first is success indicator, second is actual fingerprint,
+     * @return SimpleImmutableEntry<Boolean, String> - key is success indicator, value is actual fingerprint,
      * {@code null} if no key.
      */
-    public static Pair<Boolean, String> checkFingerPrint(String expected, Factory<? extends Digest> f, PublicKey key) {
+    public static SimpleImmutableEntry<Boolean, String> checkFingerPrint(String expected, Factory<? extends Digest> f, PublicKey key) {
         return checkFingerPrint(expected, Objects.requireNonNull(f, "No digest factory").create(), key);
     }
 
@@ -607,22 +607,22 @@ public final class KeyUtils {
      * with the default fingerprint.
      * @param d The {@link Digest} to be used to generate the default fingerprint for the key
      * @param key the {@link PublicKey} - if {@code null} then returns null.
-     * @return Pair<Boolean, String> - first is success indicator, second is actual fingerprint,
+     * @return SimpleImmutableEntry<Boolean, String> - key is success indicator, value is actual fingerprint,
      * {@code null} if no key.
      */
-    public static Pair<Boolean, String> checkFingerPrint(String expected, Digest d, PublicKey key) {
+    public static SimpleImmutableEntry<Boolean, String> checkFingerPrint(String expected, Digest d, PublicKey key) {
         if (key == null) {
             return null;
         }
 
         if (GenericUtils.isEmpty(expected)) {
-            return new Pair<>(false, getFingerPrint(d, key));
+            return new SimpleImmutableEntry<>(false, getFingerPrint(d, key));
         }
 
         // de-construct fingerprint
         int pos = expected.indexOf(':');
         if ((pos < 0) || (pos >= (expected.length() - 1))) {
-            return new Pair<>(false, getFingerPrint(d, key));
+            return new SimpleImmutableEntry<>(false, getFingerPrint(d, key));
         }
 
         String name = expected.substring(0, pos);
@@ -632,7 +632,7 @@ public final class KeyUtils {
         if (name.length() > 2) {
             expectedFactory = BuiltinDigests.fromFactoryName(name);
             if (expectedFactory == null) {
-                return new Pair<>(false, getFingerPrint(d, key));
+                return new SimpleImmutableEntry<>(false, getFingerPrint(d, key));
             }
 
             expected = name.toUpperCase() + ":" + value;
@@ -645,7 +645,7 @@ public final class KeyUtils {
         boolean matches = BuiltinDigests.md5.getName().equals(expectedFactory.getName())
                         ? expected.equalsIgnoreCase(fingerprint)    // HEX is case insensitive
                         : expected.equals(fingerprint);
-        return new Pair<>(matches, fingerprint);
+        return new SimpleImmutableEntry<>(matches, fingerprint);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/AbstractKeyPairResourceParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/AbstractKeyPairResourceParser.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/AbstractKeyPairResourceParser.java
index c2c877f..a83bf68 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/AbstractKeyPairResourceParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/AbstractKeyPairResourceParser.java
@@ -30,11 +30,11 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.logging.Level;
 
 import org.apache.sshd.common.config.keys.FilePasswordProvider;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
@@ -88,7 +88,7 @@ public abstract class AbstractKeyPairResourceParser extends AbstractLoggingBean
         Collection<KeyPair> keyPairs = Collections.emptyList();
         List<String> beginMarkers = getBeginners();
         List<List<String>> endMarkers = getEndingMarkers();
-        for (Pair<Integer, Integer> markerPos = KeyPairResourceParser.findMarkerLine(lines, beginMarkers); markerPos != null;) {
+        for (Map.Entry<Integer, Integer> markerPos = KeyPairResourceParser.findMarkerLine(lines, beginMarkers); markerPos != null;) {
             int startIndex = markerPos.getKey();
             String startLine = lines.get(startIndex);
             startIndex++;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java
index 88dd2bd..80fc2c5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java
@@ -22,6 +22,7 @@ package org.apache.sshd.common.config.keys.loader;
 import java.io.IOException;
 import java.security.GeneralSecurityException;
 import java.security.KeyPair;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Arrays;
 import java.util.Base64;
 import java.util.Collection;
@@ -31,7 +32,6 @@ import java.util.List;
 
 import org.apache.sshd.common.config.keys.FilePasswordProvider;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 
 /**
@@ -106,11 +106,11 @@ public interface KeyPairResourceParser extends KeyPairResourceLoader {
      *
      * @param lines The list of lines to scan - ignored if {@code null}/empty
      * @param markers The markers to match - ignored if {@code null}/empty
-     * @return A {@link Pair} whose key is the <U>first</U> line index
+     * @return A {@link SimpleImmutableEntry} whose key is the <U>first</U> line index
      * that matched and value the matched marker index - {@code null} if no match found
      * @see #findMarkerLine(List, int, List)
      */
-    static Pair<Integer, Integer> findMarkerLine(List<String> lines, List<String> markers) {
+    static SimpleImmutableEntry<Integer, Integer> findMarkerLine(List<String> lines, List<String> markers) {
         return findMarkerLine(lines, 0, markers);
     }
 
@@ -120,10 +120,10 @@ public interface KeyPairResourceParser extends KeyPairResourceLoader {
      * @param lines The list of lines to scan - ignored if {@code null}/empty
      * @param startLine The scan start line index
      * @param markers The markers to match - ignored if {@code null}/empty
-     * @return A {@link Pair} whose key is the <U>first</U> line index
+     * @return A {@link SimpleImmutableEntry} whose key is the <U>first</U> line index
      * that matched and value the matched marker index - {@code null} if no match found
      */
-    static Pair<Integer, Integer> findMarkerLine(List<String> lines, int startLine, List<String> markers) {
+    static SimpleImmutableEntry<Integer, Integer> findMarkerLine(List<String> lines, int startLine, List<String> markers) {
         if (GenericUtils.isEmpty(lines) || GenericUtils.isEmpty(markers)) {
             return null;
         }
@@ -133,7 +133,7 @@ public interface KeyPairResourceParser extends KeyPairResourceLoader {
             for (int markerIndex = 0; markerIndex < markers.size(); markerIndex++) {
                 String m = markers.get(markerIndex);
                 if (l.contains(m)) {
-                    return new Pair<>(lineIndex, markerIndex);
+                    return new SimpleImmutableEntry<>(lineIndex, markerIndex);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/openssh/OpenSSHKeyPairResourceParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/openssh/OpenSSHKeyPairResourceParser.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/openssh/OpenSSHKeyPairResourceParser.java
index bc068ea..b837ab1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/openssh/OpenSSHKeyPairResourceParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/openssh/OpenSSHKeyPairResourceParser.java
@@ -31,6 +31,7 @@ import java.security.KeyPair;
 import java.security.NoSuchAlgorithmException;
 import java.security.PrivateKey;
 import java.security.PublicKey;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -48,7 +49,6 @@ import org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder;
 import org.apache.sshd.common.config.keys.PublicKeyEntryDecoder;
 import org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.common.util.io.IoUtils;
@@ -185,7 +185,7 @@ public class OpenSSHKeyPairResourceParser extends AbstractKeyPairResourceParser
                         resourceKey, keyIndex, pubType);
             }
 
-            Pair<PrivateKey, String> prvData = readPrivateKey(resourceKey, context, pubType, passwordProvider, stream);
+            Map.Entry<PrivateKey, String> prvData = readPrivateKey(resourceKey, context, pubType, passwordProvider, stream);
             PrivateKey prvKey = (prvData == null) ? null : prvData.getKey();
             ValidateUtils.checkNotNull(prvKey, "Empty private key #%d in %s", keyIndex, resourceKey);
 
@@ -204,7 +204,7 @@ public class OpenSSHKeyPairResourceParser extends AbstractKeyPairResourceParser
         return keyPairs;
     }
 
-    protected Pair<PrivateKey, String> readPrivateKey(
+    protected SimpleImmutableEntry<PrivateKey, String> readPrivateKey(
             String resourceKey, OpenSSHParserContext context, String keyType, FilePasswordProvider passwordProvider, InputStream stream)
                     throws IOException, GeneralSecurityException {
         String prvType = KeyEntryResolver.decodeString(stream);
@@ -225,7 +225,7 @@ public class OpenSSHKeyPairResourceParser extends AbstractKeyPairResourceParser
         }
 
         String comment = KeyEntryResolver.decodeString(stream);
-        return new Pair<>(prvKey, comment);
+        return new SimpleImmutableEntry<>(prvKey, comment);
     }
 
     protected <S extends InputStream> S validateStreamMagicMarker(String resourceKey, S stream) throws IOException {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/pem/ECDSAPEMResourceKeyPairParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/pem/ECDSAPEMResourceKeyPairParser.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/pem/ECDSAPEMResourceKeyPairParser.java
index 9b62ccd..dd8d2ea 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/pem/ECDSAPEMResourceKeyPairParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/pem/ECDSAPEMResourceKeyPairParser.java
@@ -32,14 +32,15 @@ import java.security.interfaces.ECPublicKey;
 import java.security.spec.ECPoint;
 import java.security.spec.ECPrivateKeySpec;
 import java.security.spec.ECPublicKeySpec;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.sshd.common.cipher.ECCurves;
 import org.apache.sshd.common.config.keys.FilePasswordProvider;
 import org.apache.sshd.common.config.keys.KeyUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.io.NoCloseInputStream;
 import org.apache.sshd.common.util.io.der.ASN1Object;
 import org.apache.sshd.common.util.io.der.ASN1Type;
@@ -73,14 +74,14 @@ public class ECDSAPEMResourceKeyPairParser extends AbstractPEMResourceKeyPairPar
     public Collection<KeyPair> extractKeyPairs(
             String resourceKey, String beginMarker, String endMarker, FilePasswordProvider passwordProvider, InputStream stream)
                     throws IOException, GeneralSecurityException {
-        Pair<ECPublicKeySpec, ECPrivateKeySpec> spec = decodeECPrivateKeySpec(stream, false);
+        Map.Entry<ECPublicKeySpec, ECPrivateKeySpec> spec = decodeECPrivateKeySpec(stream, false);
         if (!SecurityUtils.isECCSupported()) {
             throw new NoSuchProviderException("ECC not supported");
         }
 
         KeyFactory kf = SecurityUtils.getKeyFactory(KeyUtils.EC_ALGORITHM);
-        ECPublicKey pubKey = (ECPublicKey) kf.generatePublic(spec.getFirst());
-        ECPrivateKey prvKey = (ECPrivateKey) kf.generatePrivate(spec.getSecond());
+        ECPublicKey pubKey = (ECPublicKey) kf.generatePublic(spec.getKey());
+        ECPrivateKey prvKey = (ECPrivateKey) kf.generatePrivate(spec.getValue());
         KeyPair kp = new KeyPair(pubKey, prvKey);
         return Collections.singletonList(kp);
     }
@@ -105,10 +106,10 @@ public class ECDSAPEMResourceKeyPairParser extends AbstractPEMResourceKeyPairPar
      * </CODE></PRE>
      * @param inputStream The {@link InputStream} containing the DER encoded data
      * @param okToClose {@code true} if OK to close the DER stream once parsing complete
-     * @return The decoded {@link Pair} of {@link ECPublicKeySpec} and {@link ECPrivateKeySpec}
+     * @return The decoded {@link SimpleImmutableEntry} of {@link ECPublicKeySpec} and {@link ECPrivateKeySpec}
      * @throws IOException If failed to to decode the DER stream
      */
-    public static Pair<ECPublicKeySpec, ECPrivateKeySpec> decodeECPrivateKeySpec(InputStream inputStream, boolean okToClose) throws IOException {
+    public static SimpleImmutableEntry<ECPublicKeySpec, ECPrivateKeySpec> decodeECPrivateKeySpec(InputStream inputStream, boolean okToClose) throws IOException {
         ASN1Object sequence;
         try (DERParser parser = new DERParser(NoCloseInputStream.resolveInputStream(inputStream, okToClose))) {
             sequence = parser.readObject();
@@ -128,7 +129,7 @@ public class ECDSAPEMResourceKeyPairParser extends AbstractPEMResourceKeyPairPar
 
             ECPoint w = decodeECPublicKeyValue(curve, parser);
             ECPublicKeySpec pubSpec = new ECPublicKeySpec(w, prvSpec.getParams());
-            return new Pair<>(pubSpec, prvSpec);
+            return new SimpleImmutableEntry<>(pubSpec, prvSpec);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 15d2520..cf3a8a2 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
@@ -24,6 +24,7 @@ import java.net.SocketTimeoutException;
 import java.net.StandardSocketOptions;
 import java.nio.channels.AsynchronousChannelGroup;
 import java.nio.channels.NetworkChannel;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
@@ -40,25 +41,25 @@ import org.apache.sshd.common.io.IoHandler;
 import org.apache.sshd.common.io.IoService;
 import org.apache.sshd.common.io.IoSession;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.closeable.AbstractInnerCloseable;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public abstract class Nio2Service extends AbstractInnerCloseable implements IoService, FactoryManagerHolder {
-    public static final Map<String, Pair<SocketOption<?>, Object>> CONFIGURABLE_OPTIONS =
-            Collections.unmodifiableMap(new LinkedHashMap<String, Pair<SocketOption<?>, Object>>() {
+    // Note: order may be important so that's why we use a LinkedHashMap
+    public static final Map<String, SimpleImmutableEntry<SocketOption<?>, Object>> CONFIGURABLE_OPTIONS =
+            Collections.unmodifiableMap(new LinkedHashMap<String, SimpleImmutableEntry<SocketOption<?>, Object>>() {
                 // Not serializing it
                 private static final long serialVersionUID = 1L;
 
                 {
-                    put(FactoryManager.SOCKET_KEEPALIVE, new Pair<SocketOption<?>, Object>(StandardSocketOptions.SO_KEEPALIVE, null));
-                    put(FactoryManager.SOCKET_LINGER, new Pair<SocketOption<?>, Object>(StandardSocketOptions.SO_LINGER, null));
-                    put(FactoryManager.SOCKET_RCVBUF, new Pair<SocketOption<?>, Object>(StandardSocketOptions.SO_RCVBUF, null));
-                    put(FactoryManager.SOCKET_REUSEADDR, new Pair<SocketOption<?>, Object>(StandardSocketOptions.SO_REUSEADDR, DEFAULT_REUSE_ADDRESS));
-                    put(FactoryManager.SOCKET_SNDBUF, new Pair<SocketOption<?>, Object>(StandardSocketOptions.SO_SNDBUF, null));
-                    put(FactoryManager.TCP_NODELAY, new Pair<SocketOption<?>, Object>(StandardSocketOptions.TCP_NODELAY, null));
+                    put(FactoryManager.SOCKET_KEEPALIVE, new SimpleImmutableEntry<>(StandardSocketOptions.SO_KEEPALIVE, null));
+                    put(FactoryManager.SOCKET_LINGER, new SimpleImmutableEntry<>(StandardSocketOptions.SO_LINGER, null));
+                    put(FactoryManager.SOCKET_RCVBUF, new SimpleImmutableEntry<>(StandardSocketOptions.SO_RCVBUF, null));
+                    put(FactoryManager.SOCKET_REUSEADDR, new SimpleImmutableEntry<>(StandardSocketOptions.SO_REUSEADDR, DEFAULT_REUSE_ADDRESS));
+                    put(FactoryManager.SOCKET_SNDBUF, new SimpleImmutableEntry<>(StandardSocketOptions.SO_SNDBUF, null));
+                    put(FactoryManager.TCP_NODELAY, new SimpleImmutableEntry<>(StandardSocketOptions.TCP_NODELAY, null));
                 }
             });
 
@@ -134,9 +135,9 @@ public abstract class Nio2Service extends AbstractInnerCloseable implements IoSe
             return socket;
         }
 
-        for (Map.Entry<String, Pair<SocketOption<?>, Object>> ce : CONFIGURABLE_OPTIONS.entrySet()) {
+        for (Map.Entry<String, ? extends Map.Entry<SocketOption<?>, ?>> ce : CONFIGURABLE_OPTIONS.entrySet()) {
             String property = ce.getKey();
-            Pair<SocketOption<?>, Object> defConfig = ce.getValue();
+            Map.Entry<SocketOption<?>, ?> defConfig = ce.getValue();
             @SuppressWarnings("rawtypes")
             SocketOption option = defConfig.getKey();
             setOption(socket, property, option, defConfig.getValue());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/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 474eda6..28bdcd8 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
@@ -23,6 +23,7 @@ import java.io.InterruptedIOException;
 import java.net.SocketAddress;
 import java.net.SocketTimeoutException;
 import java.nio.charset.StandardCharsets;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -85,7 +86,6 @@ import org.apache.sshd.common.util.EventListenerUtils;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.Invoker;
 import org.apache.sshd.common.util.NumberUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.Readable;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
@@ -633,11 +633,11 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
          *      the next packet MUST be silently ignored
          */
         for (KexProposalOption option : new KexProposalOption[]{KexProposalOption.ALGORITHMS, KexProposalOption.SERVERKEYS}) {
-            Pair<String, String> result = comparePreferredKexProposalOption(option);
+            Map.Entry<String, String> result = comparePreferredKexProposalOption(option);
             if (result != null) {
                 if (log.isDebugEnabled()) {
                     log.debug("handleFirstKexPacketFollows({})[{}] 1st follow KEX packet {} option mismatch: client={}, server={}",
-                              this, SshConstants.getCommandMessageName(cmd), option, result.getFirst(), result.getSecond());
+                              this, SshConstants.getCommandMessageName(cmd), option, result.getKey(), result.getValue());
                 }
                 return false;
             }
@@ -646,12 +646,12 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
         return true;
     }
 
-    protected Pair<String, String> comparePreferredKexProposalOption(KexProposalOption option) {
+    protected SimpleImmutableEntry<String, String> comparePreferredKexProposalOption(KexProposalOption option) {
         String[] clientPreferences = GenericUtils.split(clientProposal.get(option), ',');
         String clientValue = clientPreferences[0];
         String[] serverPreferences = GenericUtils.split(serverProposal.get(option), ',');
         String serverValue = serverPreferences[0];
-        return clientValue.equals(serverValue) ? null : new Pair<>(clientValue, serverValue);
+        return clientValue.equals(serverValue) ? null : new SimpleImmutableEntry<>(clientValue, serverValue);
     }
 
     protected void handleKexMessage(int cmd, Buffer buffer) throws Exception {
@@ -871,19 +871,19 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
         }
     }
 
-    protected List<Pair<PendingWriteFuture, IoWriteFuture>> sendPendingPackets(Queue<PendingWriteFuture> packetsQueue) throws IOException {
+    protected List<SimpleImmutableEntry<PendingWriteFuture, IoWriteFuture>> sendPendingPackets(Queue<PendingWriteFuture> packetsQueue) throws IOException {
         if (GenericUtils.isEmpty(packetsQueue)) {
             return Collections.emptyList();
         }
 
         int numPending = packetsQueue.size();
-        List<Pair<PendingWriteFuture, IoWriteFuture>> pendingWrites = new ArrayList<>(numPending);
+        List<SimpleImmutableEntry<PendingWriteFuture, IoWriteFuture>> pendingWrites = new ArrayList<>(numPending);
         synchronized (encodeLock) {
             for (PendingWriteFuture future = pendingPackets.poll();
                     future != null;
                     future = pendingPackets.poll()) {
                 IoWriteFuture writeFuture = doWritePacket(future.getBuffer());
-                pendingWrites.add(new Pair<>(future, writeFuture));
+                pendingWrites.add(new SimpleImmutableEntry<>(future, writeFuture));
             }
         }
 
@@ -2648,12 +2648,12 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
         }
 
         long now = System.currentTimeMillis();
-        Pair<TimeoutStatus, String> result = checkAuthenticationTimeout(now, getAuthTimeout());
+        Map.Entry<TimeoutStatus, String> result = checkAuthenticationTimeout(now, getAuthTimeout());
         if (result == null) {
             result = checkIdleTimeout(now, getIdleTimeout());
         }
 
-        TimeoutStatus status = (result == null) ? TimeoutStatus.NoTimeout : result.getFirst();
+        TimeoutStatus status = (result == null) ? TimeoutStatus.NoTimeout : result.getKey();
         if ((status == null) || TimeoutStatus.NoTimeout.equals(status)) {
             return;
         }
@@ -2663,7 +2663,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
         }
 
         timeoutStatus.set(status);
-        disconnect(SshConstants.SSH2_DISCONNECT_PROTOCOL_ERROR, result.getSecond());
+        disconnect(SshConstants.SSH2_DISCONNECT_PROTOCOL_ERROR, result.getValue());
     }
 
     /**
@@ -2672,15 +2672,15 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
      * @param now           The current time in millis
      * @param authTimeoutMs The configured timeout in millis - if non-positive
      *                      then no timeout
-     * @return A {@link Pair} specifying the timeout status and disconnect reason
+     * @return A {@link SimpleImmutableEntry} specifying the timeout status and disconnect reason
      * message if timeout expired, {@code null} or {@code NoTimeout} if no timeout
      * occurred
      * @see #getAuthTimeout()
      */
-    protected Pair<TimeoutStatus, String> checkAuthenticationTimeout(long now, long authTimeoutMs) {
+    protected SimpleImmutableEntry<TimeoutStatus, String> checkAuthenticationTimeout(long now, long authTimeoutMs) {
         long authDiff = now - authTimeoutStart;
         if ((!authed) && (authTimeoutMs > 0L) && (authDiff > authTimeoutMs)) {
-            return new Pair<>(TimeoutStatus.AuthTimeout, "Session has timed out waiting for authentication after " + authTimeoutMs + " ms.");
+            return new SimpleImmutableEntry<>(TimeoutStatus.AuthTimeout, "Session has timed out waiting for authentication after " + authTimeoutMs + " ms.");
         } else {
             return null;
         }
@@ -2692,15 +2692,15 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
      * @param now           The current time in millis
      * @param idleTimeoutMs The configured timeout in millis - if non-positive
      *                      then no timeout
-     * @return A {@link Pair} specifying the timeout status and disconnect reason
+     * @return A {@link SimpleImmutableEntry} specifying the timeout status and disconnect reason
      * message if timeout expired, {@code null} or {@code NoTimeout} if no timeout
      * occurred
      * @see #getIdleTimeout()
      */
-    protected Pair<TimeoutStatus, String> checkIdleTimeout(long now, long idleTimeoutMs) {
+    protected SimpleImmutableEntry<TimeoutStatus, String> checkIdleTimeout(long now, long idleTimeoutMs) {
         long idleDiff = now - idleTimeoutStart;
         if ((idleTimeoutMs > 0L) && (idleDiff > idleTimeoutMs)) {
-            return new Pair<>(TimeoutStatus.IdleTimeout, "User session has timed out idling after " + idleTimeoutMs + " ms.");
+            return new SimpleImmutableEntry<>(TimeoutStatus.IdleTimeout, "User session has timed out idling after " + idleTimeoutMs + " ms.");
         } else {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/signature/AbstractSignature.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/signature/AbstractSignature.java b/sshd-core/src/main/java/org/apache/sshd/common/signature/AbstractSignature.java
index d2849da..ef06d15 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/signature/AbstractSignature.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/signature/AbstractSignature.java
@@ -23,10 +23,10 @@ import java.security.GeneralSecurityException;
 import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.SignatureException;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Objects;
 
 import org.apache.sshd.common.util.NumberUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.common.util.security.SecurityUtils;
@@ -101,10 +101,10 @@ public abstract class AbstractSignature implements Signature {
      * Makes an attempt to detect if the signature is encoded or pure data
      *
      * @param sig The original signature
-     * @return A {@link Pair} where first value is the key type and second
+     * @return A {@link SimpleImmutableEntry} where first value is the key type and second
      * value is the data - {@code null} if not encoded
      */
-    protected Pair<String, byte[]> extractEncodedSignature(byte[] sig) {
+    protected SimpleImmutableEntry<String, byte[]> extractEncodedSignature(byte[] sig) {
         final int dataLen = NumberUtils.length(sig);
         // if it is encoded then we must have at least 2 UINT32 values
         if (dataLen < (2 * Integer.BYTES)) {
@@ -134,7 +134,7 @@ public abstract class AbstractSignature implements Signature {
         String keyType = new String(sig, keyTypeStartPos, (int) keyTypeLen, StandardCharsets.UTF_8);
         byte[] data = new byte[(int) dataBytesLen];
         System.arraycopy(sig, keyTypeEndPos + Integer.BYTES, data, 0, (int) dataBytesLen);
-        return new Pair<>(keyType, data);
+        return new SimpleImmutableEntry<>(keyType, data);
     }
 
     protected boolean doVerify(byte[] data) throws SignatureException {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureDSA.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureDSA.java b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureDSA.java
index ec5797b..1f552bd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureDSA.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureDSA.java
@@ -21,10 +21,10 @@ package org.apache.sshd.common.signature;
 import java.io.StreamCorruptedException;
 import java.math.BigInteger;
 import java.security.SignatureException;
+import java.util.Map;
 
 import org.apache.sshd.common.keyprovider.KeyPairProvider;
 import org.apache.sshd.common.util.NumberUtils;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.common.util.io.der.DERParser;
@@ -101,11 +101,11 @@ public class SignatureDSA extends AbstractSignature {
 
         if (sigLen != DSA_SIGNATURE_LENGTH) {
             // probably some encoded data
-            Pair<String, byte[]> encoding = extractEncodedSignature(sig);
+            Map.Entry<String, byte[]> encoding = extractEncodedSignature(sig);
             if (encoding != null) {
-                String keyType = encoding.getFirst();
+                String keyType = encoding.getKey();
                 ValidateUtils.checkTrue(KeyPairProvider.SSH_DSS.equals(keyType), "Mismatched key type: %s", keyType);
-                data = encoding.getSecond();
+                data = encoding.getValue();
                 sigLen = NumberUtils.length(data);
             }
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureECDSA.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureECDSA.java b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureECDSA.java
index e33a610..56964d3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureECDSA.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureECDSA.java
@@ -20,9 +20,9 @@ package org.apache.sshd.common.signature;
 
 import java.io.StreamCorruptedException;
 import java.math.BigInteger;
+import java.util.Map;
 
 import org.apache.sshd.common.cipher.ECCurves;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
@@ -101,12 +101,12 @@ public class SignatureECDSA extends AbstractSignature {
     @Override
     public boolean verify(byte[] sig) throws Exception {
         byte[] data = sig;
-        Pair<String, byte[]> encoding = extractEncodedSignature(data);
+        Map.Entry<String, byte[]> encoding = extractEncodedSignature(data);
         if (encoding != null) {
-            String keyType = encoding.getFirst();
+            String keyType = encoding.getKey();
             ECCurves curve = ECCurves.fromKeyType(keyType);
             ValidateUtils.checkNotNull(curve, "Unknown curve type: %s", keyType);
-            data = encoding.getSecond();
+            data = encoding.getValue();
         }
 
         Buffer rsBuf = new ByteArrayBuffer(data);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureRSA.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureRSA.java b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureRSA.java
index 06dac00..ad1d37e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureRSA.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureRSA.java
@@ -21,9 +21,9 @@ package org.apache.sshd.common.signature;
 import java.math.BigInteger;
 import java.security.PublicKey;
 import java.security.interfaces.RSAKey;
+import java.util.Map;
 
 import org.apache.sshd.common.keyprovider.KeyPairProvider;
-import org.apache.sshd.common.util.Pair;
 import org.apache.sshd.common.util.ValidateUtils;
 
 /**
@@ -68,11 +68,11 @@ public class SignatureRSA extends AbstractSignature {
     @Override
     public boolean verify(byte[] sig) throws Exception {
         byte[] data = sig;
-        Pair<String, byte[]> encoding = extractEncodedSignature(data);
+        Map.Entry<String, byte[]> encoding = extractEncodedSignature(data);
         if (encoding != null) {
-            String keyType = encoding.getFirst();
+            String keyType = encoding.getKey();
             ValidateUtils.checkTrue(KeyPairProvider.SSH_RSA.equals(keyType), "Mismatched key type: %s", keyType);
-            data = encoding.getSecond();
+            data = encoding.getValue();
         }
 
         int expectedSize = getVerifierSignatureSize();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/util/Invoker.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/Invoker.java b/sshd-core/src/main/java/org/apache/sshd/common/util/Invoker.java
index ded7fa0..71cbebd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/Invoker.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/Invoker.java
@@ -18,7 +18,9 @@
  */
 package org.apache.sshd.common.util;
 
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
+import java.util.Map;
 
 /**
  * The complement to the {@code Callable} interface - accepts one argument
@@ -74,7 +76,7 @@ public interface Invoker<ARG, RET> {
 
     static <ARG> Invoker<ARG, Void> wrapFirst(Collection<? extends Invoker<? super ARG, ?>> invokers) {
         return arg -> {
-            Pair<Invoker<? super ARG, ?>, Throwable> result = invokeTillFirstFailure(arg, invokers);
+            Map.Entry<Invoker<? super ARG, ?>, Throwable> result = invokeTillFirstFailure(arg, invokers);
             if (result != null) {
                 throw result.getValue();
             }
@@ -89,10 +91,10 @@ public interface Invoker<ARG, RET> {
      * @param arg The argument to pass to the {@link #invoke(Object)} method
      * @param invokers The invokers to scan - ignored if {@code null}/empty
      * (also ignores {@code null} members)
-     * @return A {@link Pair} representing the <U>first</U> failed invocation
-     * - {@code null} if all were successful (or none invoked).
+     * @return A {@link SimpleImmutableEntry} representing the <U>first</U> failed
+     * invocation - {@code null} if all were successful (or none invoked).
      */
-    static <ARG> Pair<Invoker<? super ARG, ?>, Throwable> invokeTillFirstFailure(ARG arg, Collection<? extends Invoker<? super ARG, ?>> invokers) {
+    static <ARG> SimpleImmutableEntry<Invoker<? super ARG, ?>, Throwable> invokeTillFirstFailure(ARG arg, Collection<? extends Invoker<? super ARG, ?>> invokers) {
         if (GenericUtils.isEmpty(invokers)) {
             return null;
         }
@@ -105,7 +107,7 @@ public interface Invoker<ARG, RET> {
             try {
                 i.invoke(arg);
             } catch (Throwable t) {
-                return new Pair<>(i, t);
+                return new SimpleImmutableEntry<>(i, t);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/74b6918b/sshd-core/src/main/java/org/apache/sshd/common/util/MapEntryUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/MapEntryUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/MapEntryUtils.java
new file mode 100644
index 0000000..7f176e7
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/MapEntryUtils.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sshd.common.util;
+
+import java.util.Comparator;
+import java.util.Map;
+
+/**
+ * Represents an un-modifiable pair of values
+ *
+ * @param <F> First value type
+ * @param <S> Second value type
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public final class MapEntryUtils {
+    @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 MapEntryUtils() {
+        throw new UnsupportedOperationException("No instance");
+    }
+
+    /**
+     * @param <K> The {@link Comparable} key type
+     * @param <V> The associated entry value
+     * @return A {@link Comparator} for {@link java.util.Map.Entry}-ies that
+     * compares the key values
+     */
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    public static <K extends Comparable<K>, V> Comparator<Map.Entry<K, V>> byKeyEntryComparator() {
+        return (Comparator) BY_KEY_COMPARATOR;
+    }
+}
\ No newline at end of file