You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2015/07/17 18:18:43 UTC

[23/25] mina-sshd git commit: [SSHD-542] Checkstyle validation

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java
index 3bc8a05..8204890 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentity.java
@@ -24,7 +24,6 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.LinkOption;
-import java.nio.file.OpenOption;
 import java.nio.file.Path;
 import java.nio.file.attribute.PosixFilePermission;
 import java.security.GeneralSecurityException;
@@ -43,31 +42,34 @@ import org.apache.sshd.common.config.keys.KeyUtils;
 import org.apache.sshd.common.config.keys.PublicKeyEntry;
 import org.apache.sshd.common.keyprovider.KeyPairProvider;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.SecurityUtils;
 import org.apache.sshd.common.util.Transformer;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.io.IoUtils;
 
 /**
  * Provides keys loading capability from the user's keys folder - e.g., {@code id_rsa}
+ *
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- * @see SecurityUtils#isBouncyCastleRegistered()
+ * @see org.apache.sshd.common.util.SecurityUtils#isBouncyCastleRegistered()
  */
 public final class ClientIdentity {
-    public static final String ID_FILE_PREFIX = "id_", ID_FILE_SUFFIX = "";
+
+    public static final String ID_FILE_PREFIX = "id_";
+
+    public static final String ID_FILE_SUFFIX = "";
+
+    public static final Transformer<String, String> ID_GENERATOR =
+        new Transformer<String, String>() {
+            @Override
+            public String transform(String input) {
+                return getIdentityFileName(input);
+            }
+        };
 
     private ClientIdentity() {
         throw new UnsupportedOperationException("No instance");
     }
 
-    public static final Transformer<String,String> ID_GENERATOR =
-            new Transformer<String,String>() {
-                @Override
-                public String transform(String input) {
-                    return getIdentityFileName(input);
-                }
-        };
-
     /**
      * @param name The file name - ignored if {@code null}/empty
      * @return The identity type - {@code null} if cannot determine it - e.g.,
@@ -75,8 +77,8 @@ public final class ClientIdentity {
      */
     public static String getIdentityType(String name) {
         if (GenericUtils.isEmpty(name)
-        || (name.length() <= ID_FILE_PREFIX.length())
-        || (!name.startsWith(ID_FILE_PREFIX))) {
+                || (name.length() <= ID_FILE_PREFIX.length())
+                || (!name.startsWith(ID_FILE_PREFIX))) {
             return null;
         } else {
             return name.substring(ID_FILE_PREFIX.length());
@@ -89,7 +91,7 @@ public final class ClientIdentity {
 
     /**
      * @param type The identity type - e.g., {@code rsa} - ignored
-     * if {@code null}/empty
+     *             if {@code null}/empty
      * @return The matching file name for the identity - {@code null}
      * if no name
      * @see #ID_FILE_PREFIX
@@ -101,149 +103,149 @@ public final class ClientIdentity {
     }
 
     /**
-     * @param client The {@link SshClient} to updated
-     * @param strict If {@code true} then files that do not have the required
-     * access rights are excluded from consideration
+     * @param client        The {@link SshClient} to updated
+     * @param strict        If {@code true} then files that do not have the required
+     *                      access rights are excluded from consideration
      * @param supportedOnly If {@code true} then ignore identities that are not
-     * supported internally
-     * @param provider A {@link FilePasswordProvider} - may be {@code null}
-     * if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
-     * to {@link FilePasswordProvider#getPassword(String)} is the path of the
-     * file whose key is to be loaded
-     * @param options The {@link LinkOption}s to apply when checking
-     * for existence
+     *                      supported internally
+     * @param provider      A {@link FilePasswordProvider} - may be {@code null}
+     *                      if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
+     *                      to {@link FilePasswordProvider#getPassword(String)} is the path of the
+     *                      file whose key is to be loaded
+     * @param options       The {@link LinkOption}s to apply when checking
+     *                      for existence
      * @return The updated <tt>client</tt> instance - provided a non-{@code null}
      * {@link KeyPairProvider} was generated
-     * @throws IOException If failed to access the file system
+     * @throws IOException              If failed to access the file system
      * @throws GeneralSecurityException If failed to load the keys
      * @see #getDefaultUserIdentitiesFolder()
      * @see #setKeyPairProvider(SshClient, Path, boolean, boolean, FilePasswordProvider, LinkOption...)
      */
     public static <C extends SshClient> C setKeyPairProvider(
-            C client, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption ... options)
-                    throws IOException, GeneralSecurityException {
+            C client, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption... options)
+            throws IOException, GeneralSecurityException {
         return setKeyPairProvider(client, getDefaultUserIdentitiesFolder(), strict, supportedOnly, provider, options);
     }
 
     /**
-     * @param client The {@link SshClient} to updated
-     * @param dir The folder to scan for the built-in identities
-     * @param strict If {@code true} then files that do not have the required
-     * access rights are excluded from consideration
+     * @param client        The {@link SshClient} to updated
+     * @param dir           The folder to scan for the built-in identities
+     * @param strict        If {@code true} then files that do not have the required
+     *                      access rights are excluded from consideration
      * @param supportedOnly If {@code true} then ignore identities that are not
-     * supported internally
-     * @param provider A {@link FilePasswordProvider} - may be {@code null}
-     * if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
-     * to {@link FilePasswordProvider#getPassword(String)} is the path of the
-     * file whose key is to be loaded
-     * @param options The {@link LinkOption}s to apply when checking
-     * for existence
+     *                      supported internally
+     * @param provider      A {@link FilePasswordProvider} - may be {@code null}
+     *                      if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
+     *                      to {@link FilePasswordProvider#getPassword(String)} is the path of the
+     *                      file whose key is to be loaded
+     * @param options       The {@link LinkOption}s to apply when checking
+     *                      for existence
      * @return The updated <tt>client</tt> instance - provided a non-{@code null}
      * {@link KeyPairProvider} was generated
-     * @throws IOException If failed to access the file system
+     * @throws IOException              If failed to access the file system
      * @throws GeneralSecurityException If failed to load the keys
      * @see #loadDefaultKeyPairProvider(Path, boolean, boolean, FilePasswordProvider, LinkOption...)
      */
     public static <C extends SshClient> C setKeyPairProvider(
-            C client, Path dir, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption ... options)
-                    throws IOException, GeneralSecurityException {
+            C client, Path dir, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption... options)
+            throws IOException, GeneralSecurityException {
         KeyPairProvider kpp = loadDefaultKeyPairProvider(dir, strict, supportedOnly, provider, options);
         if (kpp != null) {
             client.setKeyPairProvider(kpp);
         }
-        
+
         return client;
     }
 
     /**
-     * @param strict If {@code true} then files that do not have the required
-     * access rights are excluded from consideration
+     * @param strict        If {@code true} then files that do not have the required
+     *                      access rights are excluded from consideration
      * @param supportedOnly If {@code true} then ignore identities that are not
-     * supported internally
-     * @param provider A {@link FilePasswordProvider} - may be {@code null}
-     * if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
-     * to {@link FilePasswordProvider#getPassword(String)} is the path of the
-     * file whose key is to be loaded
-     * @param options The {@link LinkOption}s to apply when checking
-     * for existence
+     *                      supported internally
+     * @param provider      A {@link FilePasswordProvider} - may be {@code null}
+     *                      if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
+     *                      to {@link FilePasswordProvider#getPassword(String)} is the path of the
+     *                      file whose key is to be loaded
+     * @param options       The {@link LinkOption}s to apply when checking
+     *                      for existence
      * @return A {@link KeyPair} for the identities - {@code null} if no identities
      * available (e.g., after filtering unsupported ones or strict permissions)
-     * @throws IOException If failed to access the file system
+     * @throws IOException              If failed to access the file system
      * @throws GeneralSecurityException If failed to load the keys
      * @see #loadDefaultIdentities(Path, boolean, FilePasswordProvider, LinkOption...)
      * @see #getDefaultUserIdentitiesFolder()
      */
     public static KeyPairProvider loadDefaultKeyPairProvider(
-            boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption ... options)
-                    throws IOException, GeneralSecurityException {
+            boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption... options)
+            throws IOException, GeneralSecurityException {
         return loadDefaultKeyPairProvider(getDefaultUserIdentitiesFolder(), strict, supportedOnly, provider, options);
     }
 
     /**
-     * @param dir The folder to scan for the built-in identities
-     * @param strict If {@code true} then files that do not have the required
-     * access rights are excluded from consideration
+     * @param dir           The folder to scan for the built-in identities
+     * @param strict        If {@code true} then files that do not have the required
+     *                      access rights are excluded from consideration
      * @param supportedOnly If {@code true} then ignore identities that are not
-     * supported internally
-     * @param provider A {@link FilePasswordProvider} - may be {@code null}
-     * if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
-     * to {@link FilePasswordProvider#getPassword(String)} is the path of the
-     * file whose key is to be loaded
-     * @param options The {@link LinkOption}s to apply when checking
-     * for existence
+     *                      supported internally
+     * @param provider      A {@link FilePasswordProvider} - may be {@code null}
+     *                      if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
+     *                      to {@link FilePasswordProvider#getPassword(String)} is the path of the
+     *                      file whose key is to be loaded
+     * @param options       The {@link LinkOption}s to apply when checking
+     *                      for existence
      * @return A {@link KeyPair} for the identities - {@code null} if no identities
      * available (e.g., after filtering unsupported ones or strict permissions)
-     * @throws IOException If failed to access the file system
+     * @throws IOException              If failed to access the file system
      * @throws GeneralSecurityException If failed to load the keys
      * @see #loadDefaultIdentities(Path, boolean, FilePasswordProvider, LinkOption...)
      * @see IdentityUtils#createKeyPairProvider(Map, boolean)
      */
     public static KeyPairProvider loadDefaultKeyPairProvider(
-            Path dir, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption ... options)
-                    throws IOException, GeneralSecurityException {
-        Map<String,KeyPair> ids = loadDefaultIdentities(dir, strict, provider, options);
+            Path dir, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption... options)
+            throws IOException, GeneralSecurityException {
+        Map<String, KeyPair> ids = loadDefaultIdentities(dir, strict, provider, options);
         return IdentityUtils.createKeyPairProvider(ids, supportedOnly);
     }
 
     /**
-     * @param strict If {@code true} then files that do not have the required
-     * access rights are excluded from consideration
+     * @param strict   If {@code true} then files that do not have the required
+     *                 access rights are excluded from consideration
      * @param provider A {@link FilePasswordProvider} - may be {@code null}
-     * if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
-     * to {@link FilePasswordProvider#getPassword(String)} is the path of the
-     * file whose key is to be loaded
-     * @param options The {@link LinkOption}s to apply when checking
-     * for existence
+     *                 if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
+     *                 to {@link FilePasswordProvider#getPassword(String)} is the path of the
+     *                 file whose key is to be loaded
+     * @param options  The {@link LinkOption}s to apply when checking
+     *                 for existence
      * @return A {@link Map} of the found files where key=identity type (case
      * <U>insensitive</U>), value=the {@link KeyPair} of the identity
-     * @throws IOException If failed to access the file system
+     * @throws IOException              If failed to access the file system
      * @throws GeneralSecurityException If failed to load the keys
      * @see #getDefaultUserIdentitiesFolder()
      * @see #loadDefaultIdentities(Path, boolean, FilePasswordProvider, LinkOption...)
      */
-    public static Map<String,KeyPair> loadDefaultIdentities(boolean strict, FilePasswordProvider provider, LinkOption ... options)
+    public static Map<String, KeyPair> loadDefaultIdentities(boolean strict, FilePasswordProvider provider, LinkOption... options)
             throws IOException, GeneralSecurityException {
         return loadDefaultIdentities(getDefaultUserIdentitiesFolder(), strict, provider, options);
     }
 
     /**
-     * @param dir The folder to scan for the built-in identities
-     * @param strict If {@code true} then files that do not have the required
-     * access rights are excluded from consideration
+     * @param dir      The folder to scan for the built-in identities
+     * @param strict   If {@code true} then files that do not have the required
+     *                 access rights are excluded from consideration
      * @param provider A {@link FilePasswordProvider} - may be {@code null}
-     * if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
-     * to {@link FilePasswordProvider#getPassword(String)} is the path of the
-     * file whose key is to be loaded
-     * @param options The {@link LinkOption}s to apply when checking
-     * for existence
+     *                 if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
+     *                 to {@link FilePasswordProvider#getPassword(String)} is the path of the
+     *                 file whose key is to be loaded
+     * @param options  The {@link LinkOption}s to apply when checking
+     *                 for existence
      * @return A {@link Map} of the found files where key=identity type (case
      * <U>insensitive</U>), value=the {@link KeyPair} of the identity
-     * @throws IOException If failed to access the file system
+     * @throws IOException              If failed to access the file system
      * @throws GeneralSecurityException If failed to load the keys
      * @see #loadIdentities(Path, boolean, Collection, Transformer, FilePasswordProvider, LinkOption...)
      * @see BuiltinIdentities
      */
-    public static Map<String,KeyPair> loadDefaultIdentities(Path dir, boolean strict, FilePasswordProvider provider, LinkOption ... options)
+    public static Map<String, KeyPair> loadDefaultIdentities(Path dir, boolean strict, FilePasswordProvider provider, LinkOption... options)
             throws IOException, GeneralSecurityException {
         return loadIdentities(dir, strict, BuiltinIdentities.NAMES, ID_GENERATOR, provider, options);
     }
@@ -258,75 +260,77 @@ public final class ClientIdentity {
         if (GenericUtils.isEmpty(userHome)) {
             throw new FileNotFoundException("No user home value");
         }
-        
+
         Path homeDir = new File(userHome).toPath();
         return homeDir.resolve(PublicKeyEntry.STD_KEYFILE_FOLDER_NAME);
     }
 
     /**
      * Scans a folder and loads all available identity files
-     * @param dir The {@link Path} of the folder to scan - ignored if not exists
-     * @param strict If {@code true} then files that do not have the required
-     * access rights are excluded from consideration
-     * @param types The identity types - ignored if {@code null}/empty
+     *
+     * @param dir         The {@link Path} of the folder to scan - ignored if not exists
+     * @param strict      If {@code true} then files that do not have the required
+     *                    access rights are excluded from consideration
+     * @param types       The identity types - ignored if {@code null}/empty
      * @param idGenerator A {@link Transformer} to derive the file name
-     * holding the specified type
-     * @param provider A {@link FilePasswordProvider} - may be {@code null}
-     * if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
-     * to {@link FilePasswordProvider#getPassword(String)} is the path of the
-     * file whose key is to be loaded
-     * @param options The {@link LinkOption}s to apply when checking
-     * for existence
+     *                    holding the specified type
+     * @param provider    A {@link FilePasswordProvider} - may be {@code null}
+     *                    if the loaded keys are <U>guaranteed</U> not to be encrypted. The argument
+     *                    to {@link FilePasswordProvider#getPassword(String)} is the path of the
+     *                    file whose key is to be loaded
+     * @param options     The {@link LinkOption}s to apply when checking
+     *                    for existence
      * @return A {@link Map} of the found files where key=identity type (case
      * <U>insensitive</U>), value=the {@link KeyPair} of the identity
-     * @throws IOException If failed to access the file system
+     * @throws IOException              If failed to access the file system
      * @throws GeneralSecurityException If failed to load the keys
      * @see #scanIdentitiesFolder(Path, boolean, Collection, Transformer, LinkOption...)
-     * @see IdentityUtils#loadIdentities(Map, FilePasswordProvider, OpenOption...)
+     * @see IdentityUtils#loadIdentities(Map, FilePasswordProvider, java.nio.file.OpenOption...)
      */
-    public static Map<String,KeyPair> loadIdentities(
-            Path dir, boolean strict, Collection<String> types, Transformer<String,String> idGenerator, FilePasswordProvider provider, LinkOption ... options)
-                    throws IOException, GeneralSecurityException {
-        Map<String,Path> paths = scanIdentitiesFolder(dir, strict, types, idGenerator, options);
+    public static Map<String, KeyPair> loadIdentities(
+            Path dir, boolean strict, Collection<String> types, Transformer<String, String> idGenerator, FilePasswordProvider provider, LinkOption... options)
+            throws IOException, GeneralSecurityException {
+        Map<String, Path> paths = scanIdentitiesFolder(dir, strict, types, idGenerator, options);
         return IdentityUtils.loadIdentities(paths, provider, IoUtils.EMPTY_OPEN_OPTIONS);
     }
-    
+
     /**
      * Scans a folder for possible identity files
-     * @param dir The {@link Path} of the folder to scan - ignored if not exists
-     * @param strict If {@code true} then files that do not have the required
-     * access rights are excluded from consideration
-     * @param types The identity types - ignored if {@code null}/empty
+     *
+     * @param dir         The {@link Path} of the folder to scan - ignored if not exists
+     * @param strict      If {@code true} then files that do not have the required
+     *                    access rights are excluded from consideration
+     * @param types       The identity types - ignored if {@code null}/empty
      * @param idGenerator A {@link Transformer} to derive the file name
-     * holding the specified type
-     * @param options The {@link LinkOption}s to apply when checking
-     * for existence
+     *                    holding the specified type
+     * @param options     The {@link LinkOption}s to apply when checking
+     *                    for existence
      * @return A {@link Map} of the found files where key=identity type (case
      * <U>insensitive</U>), value=the {@link Path} of the file holding the key
      * @throws IOException If failed to access the file system
      * @see KeyUtils#validateStrictKeyFilePermissions(Path, LinkOption...)
      */
-    public static Map<String,Path> scanIdentitiesFolder(
-            Path dir, boolean strict, Collection<String> types, Transformer<String,String> idGenerator, LinkOption ... options)
-                    throws IOException {
+    public static Map<String, Path> scanIdentitiesFolder(
+            Path dir, boolean strict, Collection<String> types, Transformer<String, String> idGenerator, LinkOption... options)
+            throws IOException {
         if (GenericUtils.isEmpty(types)) {
             return Collections.emptyMap();
         }
-    
+
         if (!Files.exists(dir, options)) {
             return Collections.emptyMap();
         }
-        
+
         ValidateUtils.checkTrue(Files.isDirectory(dir, options), "Not a directory: %s", dir);
-        
-        Map<String,Path> paths = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+
+        Map<String, Path> paths = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         for (String t : types) {
             String fileName = idGenerator.transform(t);
             Path p = dir.resolve(fileName);
             if (!Files.exists(p, options)) {
                 continue;
             }
-            
+
             if (strict) {
                 PosixFilePermission perm = KeyUtils.validateStrictKeyFilePermissions(p, options);
                 if (perm != null) {
@@ -337,7 +341,7 @@ public final class ClientIdentity {
             Path prev = paths.put(t, p);
             ValidateUtils.checkTrue(prev == null, "Multiple mappings for type=%s", t);
         }
-        
+
         return paths;
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/future/AuthFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/AuthFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/AuthFuture.java
index 11fd830..2972567 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/future/AuthFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/future/AuthFuture.java
@@ -31,18 +31,21 @@ import org.apache.sshd.common.future.SshFuture;
 public interface AuthFuture extends SshFuture<AuthFuture> {
     /**
      * Wait and verify that the authentication succeeded.
+     *
      * @throws IOException if the authentication failed for any reason
      */
     void verify() throws IOException;
 
     /**
      * Wait and verify that the authentication succeeded within the specified timeout.
+     *
      * @throws IOException if the authentication failed for any reason
      */
     void verify(long timeout, TimeUnit unit) throws IOException;
 
     /**
      * Wait and verify that the authentication succeeded within the specified timeout.
+     *
      * @throws IOException if the authentication failed for any reason
      */
     void verify(long timeoutMillis) throws IOException;
@@ -51,7 +54,7 @@ public interface AuthFuture extends SshFuture<AuthFuture> {
      * Returns the cause of the connection failure.
      *
      * @return <tt>null</tt> if the connect operation is not finished yet,
-     *         or if the connection attempt is successful.
+     * or if the connection attempt is successful.
      */
     Throwable getException();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/future/ConnectFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/ConnectFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/ConnectFuture.java
index 3bbefa9..43fe89b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/future/ConnectFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/future/ConnectFuture.java
@@ -26,7 +26,7 @@ import org.apache.sshd.common.future.SshFuture;
 
 /**
  * An {@link SshFuture} for asynchronous connections requests.
- * 
+ *
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public interface ConnectFuture extends SshFuture<ConnectFuture> {
@@ -35,13 +35,14 @@ public interface ConnectFuture extends SshFuture<ConnectFuture> {
 
     // wait and verify that connection succeeded within specified timeout
     ConnectFuture verify(long count, TimeUnit unit) throws IOException;
+
     ConnectFuture verify(long timeout) throws IOException;
-    
+
     /**
      * Returns the cause of the connection failure.
      *
      * @return <tt>null</tt> if the connect operation is not finished yet,
-     *         or if the connection attempt is successful.
+     * or if the connection attempt is successful.
      */
     Throwable getException();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java
index 9a79045..97e00b3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultAuthFuture.java
@@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.common.SshException;
 import org.apache.sshd.common.future.DefaultSshFuture;
-import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 
 
@@ -44,7 +43,7 @@ public class DefaultAuthFuture extends DefaultSshFuture<AuthFuture> implements A
 
     @Override   // TODO for JDK-8 make this a default method
     public void verify(long timeout, TimeUnit unit) throws IOException {
-        verify(unit.toMillis(timeout));        
+        verify(unit.toMillis(timeout));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java
index 5963df9..bedac92 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultConnectFuture.java
@@ -25,7 +25,6 @@ import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.RuntimeSshException;
 import org.apache.sshd.common.future.DefaultSshFuture;
 import org.apache.sshd.common.io.IoSession;
-import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 
 /**
@@ -42,7 +41,7 @@ public class DefaultConnectFuture extends DefaultSshFuture<ConnectFuture> implem
     public ConnectFuture verify(long count, TimeUnit unit) throws IOException {
         return verify(unit.toMillis(count));
     }
-    
+
     @Override   // TODO in JDK-8 make this a default method
     public ConnectFuture verify(long timeout) throws IOException {
         long startTime = System.nanoTime();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java
index 081e242..15385c7 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/future/DefaultOpenFuture.java
@@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.common.SshException;
 import org.apache.sshd.common.future.DefaultSshFuture;
-import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 
 /**
@@ -43,7 +42,7 @@ public class DefaultOpenFuture extends DefaultSshFuture<OpenFuture> implements O
 
     @Override   // TODO for JDK-8 make this a default method
     public void verify(long timeout, TimeUnit unit) throws IOException {
-        verify(unit.toMillis(timeout));        
+        verify(unit.toMillis(timeout));
     }
 
     @Override   // TODO for JDK-8 make this a default method

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/future/OpenFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/OpenFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/OpenFuture.java
index b80dc03..116f9e5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/future/OpenFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/future/OpenFuture.java
@@ -31,17 +31,20 @@ import org.apache.sshd.common.future.SshFuture;
 public interface OpenFuture extends SshFuture<OpenFuture> {
     /**
      * Wait and verify that the channel has been successfully opened.
+     *
      * @throws IOException if the action failed for any reason
      */
     void verify() throws IOException;
+
     void verify(long timeout, TimeUnit unit) throws IOException;
+
     void verify(long timeoutMillis) throws IOException;
 
     /**
      * Returns the cause of the connection failure.
      *
      * @return <tt>null</tt> if the connect operation is not finished yet,
-     *         or if the connection attempt is successful.
+     * or if the connection attempt is successful.
      */
     Throwable getException();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/kex/AbstractDHClientKeyExchange.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/kex/AbstractDHClientKeyExchange.java b/sshd-core/src/main/java/org/apache/sshd/client/kex/AbstractDHClientKeyExchange.java
index 1a73680..ed4e18b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/kex/AbstractDHClientKeyExchange.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/kex/AbstractDHClientKeyExchange.java
@@ -24,7 +24,6 @@ import java.security.PublicKey;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.kex.dh.AbstractDHKeyExchange;
 import org.apache.sshd.common.session.AbstractSession;
-import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 
 /**
@@ -38,8 +37,8 @@ public abstract class AbstractDHClientKeyExchange extends AbstractDHKeyExchange
     }
 
     @Override
-    public void init(AbstractSession s, byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception {
-        super.init(s, V_S, V_C, I_S, I_C);
+    public void init(AbstractSession s, byte[] v_s, byte[] v_c, byte[] i_s, byte[] i_c) throws Exception {
+        super.init(s, v_s, v_c, i_s, i_c);
         ValidateUtils.checkTrue(s instanceof ClientSession, "Using a client side KeyExchange on a server");
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java b/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java
index 5f6250c..1b11e1b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java
@@ -47,6 +47,10 @@ public class DHGClient extends AbstractDHClientKeyExchange {
     protected final DHFactory factory;
     protected AbstractDH dh;
 
+    protected DHGClient(DHFactory factory) {
+        this.factory = ValidateUtils.checkNotNull(factory, "No factory");
+    }
+
     public static final KeyExchangeFactory newFactory(final DHFactory delegate) {
         return new KeyExchangeFactory() {
             @Override
@@ -68,22 +72,18 @@ public class DHGClient extends AbstractDHClientKeyExchange {
         };
     }
 
-    protected DHGClient(DHFactory factory) {
-        this.factory = ValidateUtils.checkNotNull(factory, "No factory");
-    }
-
     @Override
-    public void init(AbstractSession s, byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception {
-        super.init(s, V_S, V_C, I_S, I_C);
+    public void init(AbstractSession s, byte[] v_s, byte[] v_c, byte[] i_s, byte[] i_c) throws Exception {
+        super.init(s, v_s, v_c, i_s, i_c);
         dh = getDH();
-        hash =  dh.getHash();
+        hash = dh.getHash();
         hash.init();
         e = dh.getE();
 
         log.debug("Send SSH_MSG_KEXDH_INIT");
         Buffer buffer = s.createBuffer(SshConstants.SSH_MSG_KEXDH_INIT);
         buffer.putMPInt(e);
-        
+
         s.writePacket(buffer);
     }
 
@@ -96,18 +96,18 @@ public class DHGClient extends AbstractDHClientKeyExchange {
         int cmd = buffer.getUByte();
         if (cmd != SshConstants.SSH_MSG_KEXDH_REPLY) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_KEY_EXCHANGE_FAILED,
-                                   "Protocol error: expected packet SSH_MSG_KEXDH_REPLY, got " + cmd);
+                    "Protocol error: expected packet SSH_MSG_KEXDH_REPLY, got " + cmd);
         }
 
         log.debug("Received SSH_MSG_KEXDH_REPLY");
-        
-        byte[] K_S = buffer.getBytes();
+
+        byte[] k_s = buffer.getBytes();
         f = buffer.getMPIntAsBytes();
         byte[] sig = buffer.getBytes();
         dh.setF(f);
-        K = dh.getK();
+        k = dh.getK();
 
-        buffer = new ByteArrayBuffer(K_S);
+        buffer = new ByteArrayBuffer(k_s);
         serverKey = buffer.getRawPublicKey();
         final String keyAlg = KeyUtils.getKeyType(serverKey);
         if (GenericUtils.isEmpty(keyAlg)) {
@@ -115,24 +115,24 @@ public class DHGClient extends AbstractDHClientKeyExchange {
         }
 
         buffer = new ByteArrayBuffer();
-        buffer.putBytes(V_C);
-        buffer.putBytes(V_S);
-        buffer.putBytes(I_C);
-        buffer.putBytes(I_S);
-        buffer.putBytes(K_S);
+        buffer.putBytes(v_c);
+        buffer.putBytes(v_s);
+        buffer.putBytes(i_c);
+        buffer.putBytes(i_s);
+        buffer.putBytes(k_s);
         buffer.putMPInt(e);
         buffer.putMPInt(f);
-        buffer.putMPInt(K);
+        buffer.putMPInt(k);
         hash.update(buffer.array(), 0, buffer.available());
-        H = hash.digest();
+        h = hash.digest();
 
         Session session = getSession();
         FactoryManager manager = session.getFactoryManager();
         Signature verif = ValidateUtils.checkNotNull(NamedFactory.Utils.create(manager.getSignatureFactories(), keyAlg),
-                            "No verifier located for algorithm=%s",
-                            keyAlg);
+                "No verifier located for algorithm=%s",
+                keyAlg);
         verif.initVerifier(serverKey);
-        verif.update(H);
+        verif.update(h);
         if (!verif.verify(sig)) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_KEY_EXCHANGE_FAILED, "KeyExchange signature verification failed");
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java b/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java
index 3490b0e..d118178 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGEXClient.java
@@ -53,7 +53,11 @@ public class DHGEXClient extends AbstractDHClientKeyExchange {
     protected byte[] p;
     protected byte[] g;
 
-    public static final KeyExchangeFactory newFactory(final DHFactory delegate) {
+    protected DHGEXClient(DHFactory factory) {
+        this.factory = ValidateUtils.checkNotNull(factory, "No factory");
+    }
+
+    public static KeyExchangeFactory newFactory(final DHFactory delegate) {
         return new KeyExchangeFactory() {
             @Override
             public String getName() {
@@ -73,13 +77,10 @@ public class DHGEXClient extends AbstractDHClientKeyExchange {
             }
         };
     }
-    protected DHGEXClient(DHFactory factory) {
-        this.factory = ValidateUtils.checkNotNull(factory, "No factory");
-    }
 
     @Override
-    public void init(AbstractSession s, byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception {
-        super.init(s, V_S, V_C, I_S, I_C);
+    public void init(AbstractSession s, byte[] v_s, byte[] v_c, byte[] i_s, byte[] i_c) throws Exception {
+        super.init(s, v_s, v_c, i_s, i_c);
         log.debug("Send SSH_MSG_KEX_DH_GEX_REQUEST");
         Buffer buffer = s.createBuffer(SshConstants.SSH_MSG_KEX_DH_GEX_REQUEST);
         buffer.putInt(min);
@@ -119,13 +120,13 @@ public class DHGEXClient extends AbstractDHClientKeyExchange {
 
         if (cmd == SshConstants.SSH_MSG_KEX_DH_GEX_REPLY) {
             log.debug("Received SSH_MSG_KEX_DH_GEX_REPLY");
-            byte[] K_S = buffer.getBytes();
+            byte[] k_s = buffer.getBytes();
             f = buffer.getMPIntAsBytes();
             byte[] sig = buffer.getBytes();
             dh.setF(f);
-            K = dh.getK();
+            k = dh.getK();
 
-            buffer = new ByteArrayBuffer(K_S);
+            buffer = new ByteArrayBuffer(k_s);
             serverKey = buffer.getRawPublicKey();
             final String keyAlg = KeyUtils.getKeyType(serverKey);
             if (GenericUtils.isEmpty(keyAlg)) {
@@ -133,11 +134,11 @@ public class DHGEXClient extends AbstractDHClientKeyExchange {
             }
 
             buffer = new ByteArrayBuffer();
-            buffer.putBytes(V_C);
-            buffer.putBytes(V_S);
-            buffer.putBytes(I_C);
-            buffer.putBytes(I_S);
-            buffer.putBytes(K_S);
+            buffer.putBytes(v_c);
+            buffer.putBytes(v_s);
+            buffer.putBytes(i_c);
+            buffer.putBytes(i_s);
+            buffer.putBytes(k_s);
             buffer.putInt(min);
             buffer.putInt(prf);
             buffer.putInt(max);
@@ -145,9 +146,9 @@ public class DHGEXClient extends AbstractDHClientKeyExchange {
             buffer.putMPInt(g);
             buffer.putMPInt(e);
             buffer.putMPInt(f);
-            buffer.putMPInt(K);
+            buffer.putMPInt(k);
             hash.update(buffer.array(), 0, buffer.available());
-            H = hash.digest();
+            h = hash.digest();
 
             Session session = getSession();
             FactoryManager manager = session.getFactoryManager();
@@ -156,7 +157,7 @@ public class DHGEXClient extends AbstractDHClientKeyExchange {
                     "No verifier located for algorithm=%s",
                     keyAlg);
             verif.initVerifier(serverKey);
-            verif.update(H);
+            verif.update(h);
             if (!verif.verify(sig)) {
                 throw new SshException(SshConstants.SSH2_DISCONNECT_KEY_EXCHANGE_FAILED,
                         "KeyExchange signature verification failed");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java
index d824a2a..64653e8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java
@@ -25,9 +25,9 @@ package org.apache.sshd.client.keyverifier;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public final class AcceptAllServerKeyVerifier extends StaticServerKeyVerifier {
-	public static final AcceptAllServerKeyVerifier INSTANCE = new AcceptAllServerKeyVerifier();
+    public static final AcceptAllServerKeyVerifier INSTANCE = new AcceptAllServerKeyVerifier();
 
-	private AcceptAllServerKeyVerifier() {
-	    super(true);
-	}
+    private AcceptAllServerKeyVerifier() {
+        super(true);
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DelegatingServerKeyVerifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DelegatingServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DelegatingServerKeyVerifier.java
index 73ba903..ab33027 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DelegatingServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/DelegatingServerKeyVerifier.java
@@ -38,17 +38,17 @@ public class DelegatingServerKeyVerifier extends AbstractLoggingBean implements
         super();
     }
 
-	@Override
+    @Override
     public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
-		Map<Object, Object> metadataMap = sshClientSession.getMetadataMap();
-		Object verifier = metadataMap.get(ServerKeyVerifier.class);
-		if (verifier == null) {
-		    if (log.isTraceEnabled()) {
-		        log.trace("verifyServerKey(" + remoteAddress + ") No verifier found in ClientSession metadata; accepting server key");
-		    }
-			return true;
-		}
-		// We throw if it's not a ServerKeyVerifier...
-		return ((ServerKeyVerifier) verifier).verifyServerKey(sshClientSession, remoteAddress, serverKey);
-	}
+        Map<Object, Object> metadataMap = sshClientSession.getMetadataMap();
+        Object verifier = metadataMap.get(ServerKeyVerifier.class);
+        if (verifier == null) {
+            if (log.isTraceEnabled()) {
+                log.trace("verifyServerKey(" + remoteAddress + ") No verifier found in ClientSession metadata; accepting server key");
+            }
+            return true;
+        }
+        // We throw if it's not a ServerKeyVerifier...
+        return ((ServerKeyVerifier) verifier).verifyServerKey(sshClientSession, remoteAddress, serverKey);
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/RequiredServerKeyVerifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/RequiredServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/RequiredServerKeyVerifier.java
index 6cd5dbc..4c10165 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/RequiredServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/RequiredServerKeyVerifier.java
@@ -32,26 +32,26 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public class RequiredServerKeyVerifier extends AbstractLoggingBean implements ServerKeyVerifier {
-	private final PublicKey requiredKey;
+    private final PublicKey requiredKey;
 
-	public RequiredServerKeyVerifier(PublicKey requiredKey) {
-		this.requiredKey = requiredKey;
-	}
+    public RequiredServerKeyVerifier(PublicKey requiredKey) {
+        this.requiredKey = requiredKey;
+    }
 
-	public final PublicKey getRequiredKey() {
-	    return requiredKey;
-	}
+    public final PublicKey getRequiredKey() {
+        return requiredKey;
+    }
 
-	@Override
+    @Override
     public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
-		if (requiredKey.equals(serverKey)) {
-		    if (log.isDebugEnabled()) {
-		        log.debug("Server at {} presented expected key: {}", remoteAddress, BufferUtils.printHex(serverKey.getEncoded()));
-		    }
-			return true;
-		} else {
+        if (requiredKey.equals(serverKey)) {
+            if (log.isDebugEnabled()) {
+                log.debug("Server at {} presented expected key: {}", remoteAddress, BufferUtils.printHex(serverKey.getEncoded()));
+            }
+            return true;
+        } else {
             log.error("Server at {} presented wrong key: {}", remoteAddress, BufferUtils.printHex(serverKey.getEncoded()));
             return false;
         }
-	}
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/StaticServerKeyVerifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/StaticServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/StaticServerKeyVerifier.java
index 18bb93a..09111bd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/StaticServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/StaticServerKeyVerifier.java
@@ -29,10 +29,11 @@ import org.apache.sshd.common.util.logging.AbstractLoggingBean;
 
 /**
  * Returns the same constant answer {@code true/false} regardless
+ *
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public abstract class StaticServerKeyVerifier extends AbstractLoggingBean implements ServerKeyVerifier {
-    private final boolean   acceptance;
+    private final boolean acceptance;
 
     protected StaticServerKeyVerifier(boolean acceptance) {
         this.acceptance = acceptance;
@@ -46,12 +47,12 @@ public abstract class StaticServerKeyVerifier extends AbstractLoggingBean implem
     public final boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
         if (isAccepted()) {
             log.warn("Server at {} presented unverified {} key: {}",
-                     new Object[] { remoteAddress, (serverKey == null) ? null : serverKey.getAlgorithm(), KeyUtils.getFingerPrint(serverKey) });
+                    new Object[]{remoteAddress, (serverKey == null) ? null : serverKey.getAlgorithm(), KeyUtils.getFingerPrint(serverKey)});
             return true;
         } else {
             if (log.isDebugEnabled()) {
                 log.debug("Reject server {} unverified {} key: {}",
-                          new Object[] { remoteAddress, (serverKey == null) ? null : serverKey.getAlgorithm(), KeyUtils.getFingerPrint(serverKey) });
+                        new Object[]{remoteAddress, (serverKey == null) ? null : serverKey.getAlgorithm(), KeyUtils.getFingerPrint(serverKey)});
             }
 
             return false;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
index 4e14ffa..dc1d2bf 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/AbstractScpClient.java
@@ -106,7 +106,7 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
         local = ValidateUtils.checkNotNull(local, "Invalid argument local: %s", local);
         remote = ValidateUtils.checkNotNullAndNotEmpty(remote, "Invalid argument remote: %s", remote);
 
-        LinkOption[]    opts = IoUtils.getLinkOptions(false);
+        LinkOption[] opts = IoUtils.getLinkOptions(false);
         if (Files.isDirectory(local, opts)) {
             options = addTargetIsDirectory(options);
         }
@@ -133,7 +133,7 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
 
     @Override
     public byte[] downloadBytes(String remote) throws IOException {
-        try(ByteArrayOutputStream local = new ByteArrayOutputStream()) {
+        try (ByteArrayOutputStream local = new ByteArrayOutputStream()) {
             download(remote, local);
             return local.toByteArray();
         }
@@ -146,7 +146,7 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
 
     @Override
     public void upload(String local, String remote, Collection<Option> options) throws IOException {
-        upload(new String[] { ValidateUtils.checkNotNullAndNotEmpty(local, "Invalid argument local: %s", local) }, remote, options);
+        upload(new String[]{ValidateUtils.checkNotNullAndNotEmpty(local, "Invalid argument local: %s", local)}, remote, options);
     }
 
     @Override
@@ -158,10 +158,11 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
     public void upload(Path local, String remote, Option... options) throws IOException {
         upload(local, remote, GenericUtils.isEmpty(options) ? Collections.<Option>emptySet() : GenericUtils.of(options));
     }
-    
+
     @Override
     public void upload(Path local, String remote, Collection<Option> options) throws IOException {
-        upload(new Path[] { ValidateUtils.checkNotNull(local, "Invalid local argument: %s", local) }, remote, GenericUtils.isEmpty(options) ? Collections.<Option>emptySet() : GenericUtils.of(options));
+        upload(new Path[]{ValidateUtils.checkNotNull(local, "Invalid local argument: %s", local)},
+                remote, GenericUtils.isEmpty(options) ? Collections.<Option>emptySet() : GenericUtils.of(options));
     }
 
     @Override
@@ -176,14 +177,14 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
 
     @Override
     public void upload(byte[] data, int offset, int len, String remote, Collection<PosixFilePermission> perms, ScpTimestamp time) throws IOException {
-        try(InputStream local = new ByteArrayInputStream(data, offset, len)) {
+        try (InputStream local = new ByteArrayInputStream(data, offset, len)) {
             upload(local, remote, len, perms, time);
         }
     }
 
     @Override
     public void upload(String[] local, String remote, Collection<Option> options) throws IOException {
-        final Collection<String>    paths=Arrays.asList(ValidateUtils.checkNotNullAndNotEmpty(local, "Invalid argument local: %s", (Object) local));
+        final Collection<String> paths = Arrays.asList(ValidateUtils.checkNotNullAndNotEmpty(local, "Invalid argument local: %s", (Object) local));
         runUpload(remote, options, paths, new ScpOperationExecutor<String>() {
             @Override
             public void execute(ScpHelper helper, Collection<String> local, Collection<Option> sendOptions) throws IOException {
@@ -194,7 +195,7 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
 
     @Override
     public void upload(Path[] local, String remote, Collection<Option> options) throws IOException {
-        final Collection<Path>    paths=Arrays.asList(ValidateUtils.checkNotNullAndNotEmpty(local, "Invalid argument local: %s", (Object) local));
+        final Collection<Path> paths = Arrays.asList(ValidateUtils.checkNotNullAndNotEmpty(local, "Invalid argument local: %s", (Object) local));
         runUpload(remote, options, paths, new ScpOperationExecutor<Path>() {
             @Override
             public void execute(ScpHelper helper, Collection<Path> local, Collection<Option> sendOptions) throws IOException {
@@ -211,7 +212,7 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
             options = GenericUtils.isEmpty(options) ? EnumSet.noneOf(Option.class) : GenericUtils.of(options);
             options.add(Option.TargetIsDirectory);
         }
-        
+
         return options;
     }
 
@@ -223,7 +224,8 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
         long startTime = System.nanoTime();
         try {
             channel.open().verify(waitTimeout);
-            long endTime = System.nanoTime(), nanosWait = endTime - startTime;
+            long endTime = System.nanoTime();
+            long nanosWait = endTime - startTime;
             if (log.isTraceEnabled()) {
                 log.trace("openCommandChannel(" + session + ")[" + cmd + "]"
                         + " completed after " + nanosWait
@@ -231,8 +233,9 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
             }
 
             return channel;
-        } catch(IOException | RuntimeException e) {
-            long endTime = System.nanoTime(), nanosWait = endTime - startTime; 
+        } catch (IOException | RuntimeException e) {
+            long endTime = System.nanoTime();
+            long nanosWait = endTime - startTime;
             if (log.isTraceEnabled()) {
                 log.trace("openCommandChannel(" + session + ")[" + cmd + "]"
                         + " failed (" + e.getClass().getSimpleName() + ")"
@@ -276,7 +279,7 @@ public abstract class AbstractScpClient extends AbstractLoggingBean implements S
         return sb.toString();
     }
 
-    public static interface ScpOperationExecutor<T> {
+    public interface ScpOperationExecutor<T> {
         void execute(ScpHelper helper, Collection<T> local, Collection<Option> options) throws IOException;
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
index d3e4750..20e14be 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
@@ -38,7 +38,6 @@ import org.apache.sshd.common.scp.ScpHelper;
 import org.apache.sshd.common.scp.ScpSourceStreamResolver;
 import org.apache.sshd.common.scp.ScpTimestamp;
 import org.apache.sshd.common.scp.ScpTransferEventListener;
-import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 
 /**
@@ -96,10 +95,10 @@ public class DefaultScpClient extends AbstractScpClient {
         try {
             ScpHelper helper = new ScpHelper(channel.getInvertedOut(), channel.getInvertedIn(), fs, listener);
             helper.receive(local,
-                           options.contains(Option.Recursive),
-                           options.contains(Option.TargetIsDirectory),
-                           options.contains(Option.PreserveAttributes),
-                           ScpHelper.DEFAULT_RECEIVE_BUFFER_SIZE);
+                    options.contains(Option.Recursive),
+                    options.contains(Option.TargetIsDirectory),
+                    options.contains(Option.PreserveAttributes),
+                    ScpHelper.DEFAULT_RECEIVE_BUFFER_SIZE);
         } finally {
             channel.close(false);
         }
@@ -109,51 +108,15 @@ public class DefaultScpClient extends AbstractScpClient {
     public void upload(final InputStream local, final String remote, final long size, final Collection<PosixFilePermission> perms, final ScpTimestamp time) throws IOException {
         int namePos = ValidateUtils.checkNotNullAndNotEmpty(remote, "No remote location specified").lastIndexOf('/');
         final String name = (namePos < 0)
-                          ? remote
-                          : ValidateUtils.checkNotNullAndNotEmpty(remote.substring(namePos + 1), "No name value in remote=%s", remote)
-                          ;
+                ? remote
+                : ValidateUtils.checkNotNullAndNotEmpty(remote.substring(namePos + 1), "No name value in remote=%s", remote);
         final String cmd = createSendCommand(remote, (time != null) ? EnumSet.of(Option.PreserveAttributes) : Collections.<Option>emptySet());
         ChannelExec channel = openCommandChannel(clientSession, cmd);
         try {
             ScpHelper helper = new ScpHelper(channel.getInvertedOut(), channel.getInvertedIn(), new MockFileSystem(remote), listener);
             final Path mockPath = new MockPath(remote);
-            helper.sendStream(new ScpSourceStreamResolver() {
-                                    @Override
-                                    public String getFileName() throws IOException {
-                                        return name;
-                                    }
-                    
-                                    @Override
-                                    public Path getEventListenerFilePath() {
-                                        return mockPath;
-                                    }
-                    
-                                    @Override
-                                    public Collection<PosixFilePermission> getPermissions() throws IOException {
-                                        return perms;
-                                    }
-                    
-                                    @Override
-                                    public ScpTimestamp getTimestamp() throws IOException {
-                                        return time;
-                                    }
-                    
-                                    @Override
-                                    public long getSize() throws IOException {
-                                        return size;
-                                    }
-                    
-                                    @Override
-                                    public InputStream resolveSourceStream() throws IOException {
-                                        return local;
-                                    }
-                                    
-                                    @Override
-                                    public String toString() {
-                                        return cmd;
-                                    }
-                              },
-                              (time != null), ScpHelper.DEFAULT_SEND_BUFFER_SIZE);
+            helper.sendStream(new StreamResolver(name, mockPath, perms, time, size, local, cmd),
+                              time != null, ScpHelper.DEFAULT_SEND_BUFFER_SIZE);
         } finally {
             channel.close(false);
         }
@@ -179,7 +142,7 @@ public class DefaultScpClient extends AbstractScpClient {
             } finally {
                 try {
                     fs.close();
-                } catch(UnsupportedOperationException e) {
+                } catch (UnsupportedOperationException e) {
                     // Ignore
                 }
             }
@@ -187,4 +150,59 @@ public class DefaultScpClient extends AbstractScpClient {
             channel.close(false);
         }
     }
+
+    private static class StreamResolver implements ScpSourceStreamResolver {
+        private final String name;
+        private final Path mockPath;
+        private final Collection<PosixFilePermission> perms;
+        private final ScpTimestamp time;
+        private final long size;
+        private final java.io.InputStream local;
+        private final String cmd;
+
+        public StreamResolver(String name, Path mockPath, Collection<PosixFilePermission> perms, ScpTimestamp time, long size, InputStream local, String cmd) {
+            this.name = name;
+            this.mockPath = mockPath;
+            this.perms = perms;
+            this.time = time;
+            this.size = size;
+            this.local = local;
+            this.cmd = cmd;
+        }
+
+        @Override
+        public String getFileName() throws java.io.IOException {
+            return name;
+        }
+
+        @Override
+        public Path getEventListenerFilePath() {
+            return mockPath;
+        }
+
+        @Override
+        public Collection<PosixFilePermission> getPermissions() throws IOException {
+            return perms;
+        }
+
+        @Override
+        public ScpTimestamp getTimestamp() throws IOException {
+            return time;
+        }
+
+        @Override
+        public long getSize() throws IOException {
+            return size;
+        }
+
+        @Override
+        public InputStream resolveSourceStream() throws IOException {
+            return local;
+        }
+
+        @Override
+        public String toString() {
+            return cmd;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/scp/ScpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/ScpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/ScpClient.java
index 7db1d64..fe4c6da 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/scp/ScpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/ScpClient.java
@@ -45,39 +45,50 @@ public interface ScpClient {
      * value is used
      */
     String SCP_EXEC_CHANNEL_OPEN_TIMEOUT = "scp-exec-channel-open-timeout";
-        long DEFAULT_EXEC_CHANNEL_OPEN_TIMEOUT = TimeUnit.SECONDS.toMillis(30L);
+    long DEFAULT_EXEC_CHANNEL_OPEN_TIMEOUT = TimeUnit.SECONDS.toMillis(30L);
 
     void download(String remote, String local, Option... options) throws IOException;
+
     void download(String remote, String local, Collection<Option> options) throws IOException;
 
     void download(String remote, Path local, Option... options) throws IOException;
+
     void download(String remote, Path local, Collection<Option> options) throws IOException;
 
     // NOTE: the remote location MUST be a file or an exception is generated
     void download(String remote, OutputStream local) throws IOException;
+
     byte[] downloadBytes(String remote) throws IOException;
 
     void download(String[] remote, String local, Option... options) throws IOException;
+
     void download(String[] remote, String local, Collection<Option> options) throws IOException;
 
     void download(String[] remote, Path local, Option... options) throws IOException;
+
     void download(String[] remote, Path local, Collection<Option> options) throws IOException;
 
     void upload(String local, String remote, Option... options) throws IOException;
+
     void upload(String local, String remote, Collection<Option> options) throws IOException;
 
     void upload(Path local, String remote, Option... options) throws IOException;
+
     void upload(Path local, String remote, Collection<Option> options) throws IOException;
 
     void upload(String[] local, String remote, Option... options) throws IOException;
+
     void upload(String[] local, String remote, Collection<Option> options) throws IOException;
-    
+
     void upload(Path[] local, String remote, Option... options) throws IOException;
+
     void upload(Path[] local, String remote, Collection<Option> options) throws IOException;
-    
+
     // NOTE: due to SCP command limitations, the amount of data to be uploaded must be known a-priori
     // To upload a dynamic amount of data use SFTP
     void upload(byte[] data, String remote, Collection<PosixFilePermission> perms, ScpTimestamp time) throws IOException;
+
     void upload(byte[] data, int offset, int len, String remote, Collection<PosixFilePermission> perms, ScpTimestamp time) throws IOException;
+
     void upload(InputStream local, String remote, long size, Collection<PosixFilePermission> perms, ScpTimestamp time) throws IOException;
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
index 3525065..7d0001d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
@@ -29,7 +29,6 @@ import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.SshException;
 import org.apache.sshd.common.session.AbstractConnectionService;
 import org.apache.sshd.common.session.Session;
-import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
index 9dc9ee2..74cb75e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
@@ -24,7 +24,6 @@ import java.security.KeyPair;
 import java.util.Map;
 
 import org.apache.sshd.client.ClientFactoryManager;
-import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.auth.UserInteraction;
 import org.apache.sshd.client.channel.ChannelDirectTcpip;
 import org.apache.sshd.client.channel.ChannelExec;
@@ -42,20 +41,21 @@ import org.apache.sshd.common.session.Session;
 
 /**
  * An authenticated session to a given SSH server
- *
- * A client session is established using the {@link SshClient}.
+ * <p/>
+ * A client session is established using the {@link org.apache.sshd.client.SshClient}.
  * Once the session has been created, the user has to authenticate
- * using either {@link #authPassword(String, String)} or
- * {@link #authPublicKey(String, java.security.KeyPair)}.
- *
+ * using either {@link #addPasswordIdentity(String)} or
+ * {@link #addPublicKeyIdentity(java.security.KeyPair)} followed by
+ * a call to {$link #auth()}.
+ * <p/>
  * From this session, channels can be created using the
  * {@link #createChannel(String)} method.  Multiple channels can
  * be created on a given session concurrently.
- *
+ * <p/>
  * When using the client in an interactive mode, the
  * {@link #waitFor(int, long)} method can be used to listen to specific
  * events such as the session being established, authenticated or closed.
- *
+ * <p/>
  * When a given session is no longer used, it must be closed using the
  * {@link #close(boolean)} method.
  *
@@ -63,10 +63,10 @@ import org.apache.sshd.common.session.Session;
  */
 public interface ClientSession extends Session {
 
-    int TIMEOUT =     0x0001;
-    int CLOSED =      0x0002;
-    int WAIT_AUTH =   0x0004;
-    int AUTHED =      0x0008;
+    int TIMEOUT = 0x0001;
+    int CLOSED = 0x0002;
+    int WAIT_AUTH = 0x0004;
+    int AUTHED = 0x0008;
 
     /**
      * @param password Password to be added - may not be {@code null}/empty
@@ -77,7 +77,7 @@ public interface ClientSession extends Session {
      * @param password The password to remove - ignored if {@code null}/empty
      * @return The removed password - same one that was added via
      * {@link #addPasswordIdentity(String)} - or {@code null} if no
-     * match found 
+     * match found
      */
     String removePasswordIdentity(String password);
 
@@ -95,6 +95,7 @@ public interface ClientSession extends Session {
     KeyPair removePublicKeyIdentity(KeyPair kp);
 
     UserInteraction getUserInteraction();
+
     void setUserInteraction(UserInteraction userInteraction);
 
     /**
@@ -143,6 +144,7 @@ public interface ClientSession extends Session {
 
     /**
      * Create an SCP client from this session.
+     *
      * @return An {@link ScpClient} instance. <B>Note:</B> uses the currently
      * registered {@link ScpTransferEventListener} if any
      * @see #setScpTransferEventListener(ScpTransferEventListener)
@@ -151,10 +153,11 @@ public interface ClientSession extends Session {
 
     /**
      * Create an SCP client from this session.
+     *
      * @param listener A {@link ScpTransferEventListener} that can be used
-     * to receive information about the SCP operations - may be {@code null}
-     * to indicate no more events are required. <B>Note:</B> this listener
-     * is used <U>instead</U> of any listener set via {@link #setScpTransferEventListener(ScpTransferEventListener)}
+     *                 to receive information about the SCP operations - may be {@code null}
+     *                 to indicate no more events are required. <B>Note:</B> this listener
+     *                 is used <U>instead</U> of any listener set via {@link #setScpTransferEventListener(ScpTransferEventListener)}
      * @return An {@link ScpClient} instance
      */
     ScpClient createScpClient(ScpTransferEventListener listener);
@@ -167,31 +170,36 @@ public interface ClientSession extends Session {
 
     /**
      * @param listener A default {@link ScpTransferEventListener} that can be used
-     * to receive information about the SCP operations - may be {@code null}
-     * to indicate no more events are required
+     *                 to receive information about the SCP operations - may be {@code null}
+     *                 to indicate no more events are required
      * @see #createScpClient(ScpTransferEventListener)
      */
     void setScpTransferEventListener(ScpTransferEventListener listener);
 
     /**
      * Create an SFTP client from this session.
+     *
      * @return The created {@link SftpClient}
      * @throws IOException if failed to create the client
      */
     SftpClient createSftpClient() throws IOException;
+
     /**
      * @param selector The {@link SftpVersionSelector} to use - <B>Note:</B>
-     * if the server does not support versions re-negotiation then the
-     * selector will be presented with only one &quot;choice&quot; - the
-     * current version
+     *                 if the server does not support versions re-negotiation then the
+     *                 selector will be presented with only one &quot;choice&quot; - the
+     *                 current version
      * @return The created {@link SftpClient}
      * @throws IOException If failed to create the client or re-negotiate
      */
     SftpClient createSftpClient(SftpVersionSelector selector) throws IOException;
 
     FileSystem createSftpFileSystem() throws IOException;
+
     FileSystem createSftpFileSystem(SftpVersionSelector selector) throws IOException;
+
     FileSystem createSftpFileSystem(int readBufferSize, int writeBufferSize) throws IOException;
+
     FileSystem createSftpFileSystem(SftpVersionSelector selector, int readBufferSize, int writeBufferSize) throws IOException;
 
     /**
@@ -207,19 +215,18 @@ public interface ClientSession extends Session {
     /**
      * Start forwarding tcpip from the given address on the server to the
      * given address on the client.
-     *
+     * <p/>
      * The remote host name is the address to bind to on the server:
      * <ul>
-     *    <li>"" means that connections are to be accepted on all protocol families
-     *              supported by the SSH implementation</li>
-     *    <li>"0.0.0.0" means to listen on all IPv4 addresses</li>
-     *    <li>"::" means to listen on all IPv6 addresses</li>
-     *    <li>"localhost" means to listen on all protocol families supported by the SSH
-     *              implementation on loopback addresses only, [RFC3330] and RFC3513]</li>
-     *    <li>"127.0.0.1" and "::1" indicate listening on the loopback interfaces for
-     *              IPv4 and IPv6 respectively</li>
+     * <li>"" means that connections are to be accepted on all protocol families
+     * supported by the SSH implementation</li>
+     * <li>"0.0.0.0" means to listen on all IPv4 addresses</li>
+     * <li>"::" means to listen on all IPv6 addresses</li>
+     * <li>"localhost" means to listen on all protocol families supported by the SSH
+     * implementation on loopback addresses only, [RFC3330] and RFC3513]</li>
+     * <li>"127.0.0.1" and "::1" indicate listening on the loopback interfaces for
+     * IPv4 and IPv6 respectively</li>
      * </ul>
-     *
      */
     SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException;
 
@@ -258,18 +265,19 @@ public interface ClientSession extends Session {
     /**
      * @return The ClientFactoryManager for this session.
      */
-    @Override ClientFactoryManager getFactoryManager();
+    @Override
+    ClientFactoryManager getFactoryManager();
 
     /**
      * Switch to a none cipher for performance.
-     *
+     * <p/>
      * This should be done after the authentication phase has been performed.
      * After such a switch, interactive channels are not allowed anymore.
      * Both client and server must have been configured to support the none cipher.
      * If that's not the case, the returned future will be set with an exception.
      *
      * @return an {@link SshFuture} that can be used to wait for the exchange
-     *         to be finished
+     * to be finished
      * @throws IOException if a key exchange is already running
      */
     @SuppressWarnings("rawtypes")

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
index a1252af..b9b7e16 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
@@ -81,32 +81,34 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
      * objects are {@link String}s and equal to each other
      */
     public static final Comparator<Object> PASSWORD_IDENTITY_COMPARATOR = new Comparator<Object>() {
-            @Override
-            public int compare(Object o1, Object o2) {
-                if ((!(o1 instanceof String)) || (!(o2 instanceof String))) {
-                    return (-1);
-                } else {
-                    return ((String) o1).compareTo((String) o2);
-                }
+        @Override
+        public int compare(Object o1, Object o2) {
+            if (!(o1 instanceof String) || !(o2 instanceof String)) {
+                return -1;
+            } else {
+                return ((String) o1).compareTo((String) o2);
             }
-        };
+        }
+    };
 
     /**
      * Compares 2 {@link KeyPair} identities - returns zero ONLY if <U>both</U> compared
      * objects are {@link KeyPair}s and equal to each other
      */
     public static final Comparator<Object> KEYPAIR_IDENTITY_COMPARATOR = new Comparator<Object>() {
-            @Override
-            public int compare(Object o1, Object o2) {
-                if ((!(o1 instanceof KeyPair)) || (!(o2 instanceof KeyPair))) {
-                    return (-1);
-                } else if (KeyUtils.compareKeyPairs((KeyPair) o1, (KeyPair) o2)) {
-                    return 0; 
-                } else {
-                    return 1;
-                }
+        @Override
+        public int compare(Object o1, Object o2) {
+            if ((!(o1 instanceof KeyPair)) || (!(o2 instanceof KeyPair))) {
+                return -1;
+            } else if (KeyUtils.compareKeyPairs((KeyPair) o1, (KeyPair) o2)) {
+                return 0;
+            } else {
+                return 1;
             }
-        };
+        }
+    };
+
+    protected AuthFuture authFuture;
 
     /**
      * For clients to store their own metadata
@@ -122,8 +124,6 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
     private UserInteraction userInteraction;
     private ScpTransferEventListener scpListener;
 
-    protected AuthFuture authFuture;
-
     public ClientSessionImpl(ClientFactoryManager client, IoSession session) throws Exception {
         super(false, client, session);
         log.debug("Client session created: {}", session);
@@ -153,9 +153,9 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
     protected Service[] getServices() {
         Service[] services;
         if (nextService != null) {
-            services = new Service[] { currentService, nextService };
+            services = new Service[]{currentService, nextService};
         } else if (currentService != null) {
-            services = new Service[] { currentService };
+            services = new Service[]{currentService};
         } else {
             services = new Service[0];
         }
@@ -207,7 +207,7 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
         if (kp == null) {
             return null;
         }
-        
+
         int index = findIdentityIndex(KEYPAIR_IDENTITY_COMPARATOR, kp);
         if (index >= 0) {
             return (KeyPair) identities.remove(index);
@@ -223,8 +223,8 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
                 return index;
             }
         }
-        
-        return (-1);
+
+        return -1;
     }
 
     @Override
@@ -242,10 +242,11 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
         if (username == null) {
             throw new IllegalStateException("No username specified when the session was created");
         }
-        
+
         ClientUserAuthService authService = getUserAuthService();
         synchronized (lock) {
-            return authFuture = authService.auth(identities, nextServiceName());
+            authFuture = authService.auth(identities, nextServiceName());
+            return authFuture;
         }
     }
 
@@ -272,22 +273,24 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
     @SuppressWarnings("rawtypes")
     public SshFuture switchToNoneCipher() throws IOException {
         if (!(currentService instanceof AbstractConnectionService)
-         || !((AbstractConnectionService) currentService).getChannels().isEmpty()) {
+                || !((AbstractConnectionService) currentService).getChannels().isEmpty()) {
             throw new IllegalStateException("The switch to the none cipher must be done immediately after authentication");
         }
         if (kexState.compareAndSet(KexState.DONE, KexState.INIT)) {
             reexchangeFuture = new DefaultSshFuture(null);
-            
-            String c2sEncServer, s2cEncServer;
-            synchronized(serverProposal) {
+
+            String c2sEncServer;
+            String s2cEncServer;
+            synchronized (serverProposal) {
                 c2sEncServer = serverProposal.get(KexProposalOption.C2SENC);
-                s2cEncServer  = serverProposal.get(KexProposalOption.S2CENC);
+                s2cEncServer = serverProposal.get(KexProposalOption.S2CENC);
             }
             boolean c2sEncServerNone = BuiltinCiphers.Constants.isNoneCipherIncluded(c2sEncServer);
             boolean s2cEncServerNone = BuiltinCiphers.Constants.isNoneCipherIncluded(s2cEncServer);
 
-            String c2sEncClient, s2cEncClient;
-            synchronized(clientProposal) {
+            String c2sEncClient;
+            String s2cEncClient;
+            synchronized (clientProposal) {
                 c2sEncClient = clientProposal.get(KexProposalOption.C2SENC);
                 s2cEncClient = clientProposal.get(KexProposalOption.S2CENC);
             }
@@ -301,9 +304,9 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
                 reexchangeFuture.setValue(new SshException("Client does not support none cipher"));
             } else {
                 log.info("Switching to none cipher");
-                
-                Map<KexProposalOption,String> proposal = new EnumMap<KexProposalOption, String>(KexProposalOption.class);
-                synchronized(clientProposal) {
+
+                Map<KexProposalOption, String> proposal = new EnumMap<KexProposalOption, String>(KexProposalOption.class);
+                synchronized (clientProposal) {
                     proposal.putAll(clientProposal);
                 }
 
@@ -442,7 +445,7 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
     @Override
     public FileSystem createSftpFileSystem(SftpVersionSelector selector, int readBufferSize, int writeBufferSize) throws IOException {
         SftpFileSystemProvider provider = new SftpFileSystemProvider((org.apache.sshd.client.SshClient) factoryManager, selector);
-        SftpFileSystem  fs = provider.newFileSystem(this);
+        SftpFileSystem fs = provider.newFileSystem(this);
         fs.setReadBufferSize(readBufferSize);
         fs.setWriteBufferSize(writeBufferSize);
         return fs;
@@ -536,7 +539,7 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
         log.debug("Server version string: {}", serverVersion);
         if (!(serverVersion.startsWith("SSH-2.0-") || serverVersion.startsWith("SSH-1.99-"))) {
             throw new SshException(SshConstants.SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED,
-                                   "Unsupported protocol version: " + serverVersion);
+                    "Unsupported protocol version: " + serverVersion);
         }
         return true;
     }
@@ -548,14 +551,14 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
     }
 
     @Override
-    protected byte[] sendKexInit(Map<KexProposalOption,String> proposal) throws IOException {
+    protected byte[] sendKexInit(Map<KexProposalOption, String> proposal) throws IOException {
         mergeProposals(clientProposal, proposal);
         return super.sendKexInit(proposal);
     }
 
     @Override
     protected void setKexSeed(byte... seed) {
-        I_C = ValidateUtils.checkNotNullAndNotEmpty(seed, "No KEX seed");
+        i_c = ValidateUtils.checkNotNullAndNotEmpty(seed, "No KEX seed");
     }
 
     @Override
@@ -565,9 +568,9 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession
     }
 
     @Override
-    protected void receiveKexInit(Map<KexProposalOption,String> proposal, byte[] seed) throws IOException {
+    protected void receiveKexInit(Map<KexProposalOption, String> proposal, byte[] seed) throws IOException {
         mergeProposals(serverProposal, proposal);
-        I_S = seed;
+        i_s = seed;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/17f2d627/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
index 316dffc..378807a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java
@@ -52,7 +52,7 @@ public class ClientUserAuthService extends CloseableUtils.AbstractCloseable impl
      */
     private final AuthFuture authFuture;
 
-    protected final ClientSessionImpl session;
+    private final ClientSessionImpl session;
 
     private List<Object> identities;
     private String service;
@@ -62,6 +62,8 @@ public class ClientUserAuthService extends CloseableUtils.AbstractCloseable impl
     private List<String> serverMethods;
     private UserAuth userAuth;
 
+    private int currentMethod;
+
     public ClientUserAuthService(Session s) {
         if (!(s instanceof ClientSessionImpl)) {
             throw new IllegalStateException("Client side service used on server side");
@@ -75,7 +77,7 @@ public class ClientUserAuthService extends CloseableUtils.AbstractCloseable impl
         String prefs = FactoryManagerUtils.getString(manager, ClientFactoryManager.PREFERRED_AUTHS);
         if (!GenericUtils.isEmpty(prefs)) {
             for (String pref : prefs.split(",")) {
-                NamedFactory<UserAuth> factory = NamedResource.Utils.findByName(pref, String.CASE_INSENSITIVE_ORDER, authFactories); 
+                NamedFactory<UserAuth> factory = NamedResource.Utils.findByName(pref, String.CASE_INSENSITIVE_ORDER, authFactories);
                 if (factory != null) {
                     clientMethods.add(pref);
                 } else {
@@ -135,10 +137,9 @@ public class ClientUserAuthService extends CloseableUtils.AbstractCloseable impl
         }
     }
 
-    private int currentMethod;
-
     /**
      * execute one step in user authentication.
+     *
      * @param buffer
      * @throws java.io.IOException
      */
@@ -209,7 +210,8 @@ public class ClientUserAuthService extends CloseableUtils.AbstractCloseable impl
                 return;
             }
             String method = clientMethods.get(currentMethod);
-            if ((userAuth = NamedFactory.Utils.create(authFactories, method)) == null) {
+            userAuth = NamedFactory.Utils.create(authFactories, method);
+            if (userAuth == null) {
                 throw new UnsupportedOperationException("Failed to find a user-auth factory for method=" + method);
             }
             userAuth.init(session, service, identities);