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 2015/06/08 13:30:19 UTC

[6/6] mina-sshd git commit: [SSHD-483] Move classes from org.apache.sshd to their rightful location - common, client or server

[SSHD-483] Move classes from org.apache.sshd to their rightful location - common, client or server


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

Branch: refs/heads/master
Commit: 9b98f342de61d56ed82d1ceba28d6358865218aa
Parents: 0857f83
Author: Lyor Goldstein <lg...@vmware.com>
Authored: Mon Jun 8 14:29:46 2015 +0300
Committer: Lyor Goldstein <lg...@vmware.com>
Committed: Mon Jun 8 14:29:46 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/sshd/ClientChannel.java     | 103 ----
 .../java/org/apache/sshd/ClientSession.java     | 246 --------
 .../main/java/org/apache/sshd/SshBuilder.java   | 506 -----------------
 .../main/java/org/apache/sshd/SshClient.java    | 557 -------------------
 .../main/java/org/apache/sshd/SshServer.java    | 473 ----------------
 .../org/apache/sshd/agent/SshAgentFactory.java  |   2 +-
 .../org/apache/sshd/agent/SshAgentServer.java   |   4 +-
 .../org/apache/sshd/agent/local/AgentImpl.java  |   2 +-
 .../sshd/agent/local/AgentServerProxy.java      |  45 +-
 .../agent/local/ChannelAgentForwarding.java     |   2 +-
 .../sshd/agent/local/LocalAgentFactory.java     |   2 +-
 .../sshd/agent/local/ProxyAgentFactory.java     |  20 +-
 .../sshd/agent/unix/AgentServerProxy.java       |   3 +-
 .../sshd/agent/unix/ChannelAgentForwarding.java |   2 +-
 .../sshd/agent/unix/UnixAgentFactory.java       |   4 +-
 .../org/apache/sshd/client/ClientBuilder.java   | 110 ++++
 .../sshd/client/ClientFactoryManager.java       |   2 +-
 .../apache/sshd/client/ServerKeyVerifier.java   |   2 +-
 .../org/apache/sshd/client/SessionFactory.java  |   2 +-
 .../java/org/apache/sshd/client/SshClient.java  | 555 ++++++++++++++++++
 .../java/org/apache/sshd/client/UserAuth.java   |   2 +-
 .../auth/UserAuthKeyboardInteractive.java       |   2 +-
 .../sshd/client/auth/UserAuthPassword.java      |   2 +-
 .../sshd/client/auth/UserAuthPublicKey.java     |   4 +-
 .../client/channel/AbstractClientChannel.java   |  18 +-
 .../sshd/client/channel/ClientChannel.java      | 103 ++++
 .../channel/PtyCapableChannelSession.java       |   4 +-
 .../sshd/client/future/ConnectFuture.java       |   2 +-
 .../client/future/DefaultConnectFuture.java     |   2 +-
 .../org/apache/sshd/client/kex/DHGClient.java   |   4 +-
 .../org/apache/sshd/client/kex/DHGEXClient.java |   4 +-
 .../DelegatingServerKeyVerifier.java            |   2 +-
 .../keyverifier/RequiredServerKeyVerifier.java  |   2 +-
 .../keyverifier/StaticServerKeyVerifier.java    |   2 +-
 .../sshd/client/scp/DefaultScpClient.java       |   2 +-
 .../client/session/ClientConnectionService.java |   2 +-
 .../sshd/client/session/ClientSession.java      | 249 +++++++++
 .../sshd/client/session/ClientSessionImpl.java  |   8 +-
 .../client/session/ClientUserAuthService.java   |   2 +-
 .../sshd/client/sftp/DefaultSftpClient.java     |  15 +-
 .../apache/sshd/client/sftp/SftpFileSystem.java |   2 +-
 .../client/sftp/SftpFileSystemProvider.java     |   8 +-
 .../sshd/common/AbstractFactoryManager.java     |   9 +
 .../sshd/common/AbstractSessionIoHandler.java   |  61 --
 .../org/apache/sshd/common/BaseBuilder.java     | 327 +++++++++++
 .../java/org/apache/sshd/common/Channel.java    |  82 ---
 .../java/org/apache/sshd/common/Cipher.java     |  68 ---
 .../java/org/apache/sshd/common/Digest.java     |  36 --
 .../org/apache/sshd/common/FactoryManager.java  |   9 +
 .../apache/sshd/common/FactoryManagerUtils.java |   1 +
 .../apache/sshd/common/ForwardingFilter.java    | 247 --------
 .../org/apache/sshd/common/KeyExchange.java     |  79 ---
 .../main/java/org/apache/sshd/common/Mac.java   |  38 --
 .../java/org/apache/sshd/common/PtyMode.java    |  75 ---
 .../java/org/apache/sshd/common/Random.java     |  43 --
 .../org/apache/sshd/common/RequestHandler.java  |  51 --
 .../java/org/apache/sshd/common/Service.java    |   1 +
 .../org/apache/sshd/common/ServiceFactory.java  |   1 +
 .../java/org/apache/sshd/common/Session.java    | 255 ---------
 .../org/apache/sshd/common/SessionListener.java |  53 --
 .../java/org/apache/sshd/common/Signature.java  |  69 ---
 .../org/apache/sshd/common/TcpipForwarder.java  |  86 ---
 .../sshd/common/TcpipForwarderFactory.java      |  37 --
 .../sshd/common/channel/AbstractChannel.java    |   4 +-
 .../org/apache/sshd/common/channel/Channel.java |  83 +++
 .../common/channel/ChannelAsyncInputStream.java |   1 -
 .../channel/ChannelAsyncOutputStream.java       |   1 -
 .../org/apache/sshd/common/channel/PtyMode.java |  75 +++
 .../sshd/common/channel/RequestHandler.java     |  51 ++
 .../apache/sshd/common/channel/SttySupport.java | 274 +++++++++
 .../org/apache/sshd/common/channel/Window.java  |   2 +-
 .../apache/sshd/common/cipher/BaseCipher.java   |   1 -
 .../sshd/common/cipher/BuiltinCiphers.java      |   1 -
 .../org/apache/sshd/common/cipher/Cipher.java   |  68 +++
 .../sshd/common/cipher/CipherFactory.java       |   1 -
 .../apache/sshd/common/cipher/CipherNone.java   |   1 -
 .../org/apache/sshd/common/cipher/ECCurves.java |   2 +-
 .../org/apache/sshd/common/cipher/package.html  |   3 +-
 .../apache/sshd/common/compression/package.html |   2 +-
 .../sshd/common/config/SshConfigFileReader.java |  16 +-
 .../sshd/common/config/keys/KeyUtils.java       |   2 +-
 .../apache/sshd/common/digest/BaseDigest.java   |   1 -
 .../sshd/common/digest/BuiltinDigests.java      |   1 -
 .../org/apache/sshd/common/digest/Digest.java   |  36 ++
 .../org/apache/sshd/common/digest/package.html  |   2 +-
 .../sshd/common/file/FileSystemFactory.java     |   2 +-
 .../file/nativefs/NativeFileSystemFactory.java  |   2 +-
 .../file/root/RootedFileSystemProvider.java     | 127 +++--
 .../virtualfs/VirtualFileSystemFactory.java     |   2 +-
 .../common/forward/DefaultTcpipForwarder.java   |   7 +-
 .../forward/DefaultTcpipForwarderFactory.java   |  24 +-
 .../sshd/common/forward/TcpipForwarder.java     |  89 +++
 .../common/forward/TcpipForwarderFactory.java   |  37 ++
 .../sshd/common/forward/TcpipServerChannel.java | 287 ----------
 .../io/nio2/Nio2ServiceFactoryFactory.java      |   4 +-
 .../org/apache/sshd/common/kex/AbstractDH.java  |   2 +-
 .../java/org/apache/sshd/common/kex/DHG.java    |   2 +-
 .../java/org/apache/sshd/common/kex/ECDH.java   |   2 +-
 .../org/apache/sshd/common/kex/KeyExchange.java |  80 +++
 .../common/kex/dh/AbstractDHKeyExchange.java    |   4 +-
 .../org/apache/sshd/common/mac/BaseMac.java     |  11 +-
 .../org/apache/sshd/common/mac/BuiltinMacs.java |   3 +-
 .../java/org/apache/sshd/common/mac/Mac.java    |  39 ++
 .../org/apache/sshd/common/mac/MacFactory.java  |   1 -
 .../org/apache/sshd/common/mac/package.html     |   2 +-
 .../sshd/common/random/BouncyCastleRandom.java  |   1 -
 .../apache/sshd/common/random/JceRandom.java    |  11 +-
 .../org/apache/sshd/common/random/Random.java   |  43 ++
 .../common/random/SingletonRandomFactory.java   |   1 -
 .../org/apache/sshd/common/random/package.html  |   2 +-
 .../session/AbstractConnectionService.java      |   7 +-
 .../sshd/common/session/AbstractSession.java    |  17 +-
 .../common/session/AbstractSessionFactory.java  |   2 -
 .../session/AbstractSessionIoHandler.java       |  60 ++
 .../sshd/common/session/ConnectionService.java  |   4 +-
 .../org/apache/sshd/common/session/Session.java | 259 +++++++++
 .../sshd/common/session/SessionListener.java    |  53 ++
 .../common/session/SessionTimeoutListener.java  |   2 -
 .../common/signature/AbstractSignature.java     |  19 +-
 .../common/signature/BuiltinSignatures.java     |   3 +-
 .../apache/sshd/common/signature/Signature.java |  73 +++
 .../sshd/common/signature/SignatureFactory.java |   1 -
 .../apache/sshd/common/signature/package.html   |   2 +-
 .../apache/sshd/common/util/CloseableUtils.java |   3 +
 .../apache/sshd/common/util/SttySupport.java    | 276 ---------
 .../src/main/java/org/apache/sshd/package.html  |  25 -
 .../org/apache/sshd/server/Environment.java     |   2 +-
 .../org/apache/sshd/server/ServerBuilder.java   | 125 +++++
 .../java/org/apache/sshd/server/SshServer.java  | 468 ++++++++++++++++
 .../auth/CachingPublicKeyAuthenticator.java     |   4 +-
 .../sshd/server/auth/UserAuthPublicKey.java     |   2 +-
 .../sshd/server/channel/AsyncDataReceiver.java  |   2 +-
 .../sshd/server/channel/ChannelSession.java     |  13 +-
 .../server/channel/PuttyRequestHandler.java     |   4 +-
 .../sshd/server/forward/ForwardingFilter.java   | 250 +++++++++
 .../sshd/server/forward/TcpipServerChannel.java | 286 ++++++++++
 .../global/CancelTcpipForwardHandler.java       |  25 +-
 .../sshd/server/global/KeepAliveHandler.java    |   5 +-
 .../server/global/NoMoreSessionsHandler.java    |   5 +-
 .../sshd/server/global/TcpipForwardHandler.java |  23 +-
 .../org/apache/sshd/server/kex/DHGEXServer.java |   6 +-
 .../org/apache/sshd/server/kex/DHGServer.java   |   4 +-
 .../server/session/ServerConnectionService.java |   2 +-
 .../server/session/ServerUserAuthService.java   |   2 +-
 .../sshd/server/session/SessionFactory.java     |   2 +-
 .../org/apache/sshd/AbstractSessionTest.java    |   1 +
 .../test/java/org/apache/sshd/AgentTest.java    |   5 +-
 .../org/apache/sshd/AuthenticationTest.java     |   3 +
 .../test/java/org/apache/sshd/CipherTest.java   |   9 +-
 .../test/java/org/apache/sshd/ClientTest.java   |  10 +-
 .../test/java/org/apache/sshd/EcdsaTest.java    |   5 +-
 .../java/org/apache/sshd/KeepAliveTest.java     |   4 +
 .../java/org/apache/sshd/KeyReExchangeTest.java |   8 +-
 .../src/test/java/org/apache/sshd/LoadTest.java |   9 +-
 .../src/test/java/org/apache/sshd/MacTest.java  |   7 +-
 .../org/apache/sshd/PortForwardingLoadTest.java |   3 +-
 .../org/apache/sshd/PortForwardingTest.java     |   5 +-
 .../test/java/org/apache/sshd/ProxyTest.java    |   5 +-
 .../test/java/org/apache/sshd/RandomTest.java   |   2 +-
 .../test/java/org/apache/sshd/ServerMain.java   |   2 +
 .../test/java/org/apache/sshd/ServerTest.java   |   9 +-
 .../apache/sshd/SinglePublicKeyAuthTest.java    |   3 +
 .../java/org/apache/sshd/SpringConfigTest.java  |   5 +
 .../java/org/apache/sshd/SshBuilderTest.java    |   4 +-
 .../java/org/apache/sshd/SshServerMain.java     |   2 +
 .../java/org/apache/sshd/SshServerTest.java     |   1 +
 .../java/org/apache/sshd/WelcomeBannerTest.java |   3 +
 .../java/org/apache/sshd/WindowAdjustTest.java  |   4 +
 .../test/java/org/apache/sshd/WindowTest.java   |  10 +-
 .../org/apache/sshd/client/kex/KexTest.java     |  14 +-
 .../StaticServerKeyVerifierTest.java            |   2 +-
 .../org/apache/sshd/client/scp/ScpTest.java     |   8 +-
 .../sshd/client/sftp/SftpFileSystemTest.java    |   4 +-
 .../org/apache/sshd/client/sftp/SftpTest.java   |   8 +-
 .../sshd/common/FactoryManagerUtilsTest.java    |   1 +
 .../sshd/common/ForwardingFilterTest.java       |   4 +-
 .../sshd/common/cipher/BaseCipherTest.java      |   3 +-
 .../sshd/common/cipher/BuiltinCiphersTest.java  |   1 -
 .../common/compression/CompressionTest.java     |   2 +-
 .../common/config/SshConfigFileReaderTest.java  |  16 +-
 .../apache/sshd/common/future/FutureTest.java   |  14 +-
 .../apache/sshd/common/mac/BuiltinMacsTest.java |   1 -
 .../common/signature/BuiltinSignaturesTest.java |   1 -
 .../sshd/common/util/SttySupportTest.java       |   3 +-
 .../deprecated/ClientUserAuthServiceOld.java    |   2 +-
 .../sshd/deprecated/UserAuthPublicKey.java      |   2 +-
 .../org/apache/sshd/util/BogusEnvironment.java  |   2 +-
 sshd-core/src/test/resources/spring.xml         |   5 +-
 .../git/transport/GitSshdSessionFactory.java    |   6 +-
 .../sshd/git/pack/GitPackCommandTest.java       |   2 +-
 .../apache/sshd/git/pgm/GitPgmCommandTest.java  |   8 +-
 191 files changed, 4312 insertions(+), 4076 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/9b98f342/sshd-core/src/main/java/org/apache/sshd/ClientChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/ClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/ClientChannel.java
deleted file mode 100644
index 5e8211e..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/ClientChannel.java
+++ /dev/null
@@ -1,103 +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;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.sshd.client.future.OpenFuture;
-import org.apache.sshd.common.future.CloseFuture;
-import org.apache.sshd.common.io.IoInputStream;
-import org.apache.sshd.common.io.IoOutputStream;
-
-/**
- * A client channel used to communicate with
- * the SSH server.  Client channels can be shells,
- * simple commands or subsystems
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public interface ClientChannel extends Closeable {
-
-    String CHANNEL_EXEC = "exec";
-    String CHANNEL_SHELL = "shell";
-    String CHANNEL_SUBSYSTEM = "subsystem";
-
-    int TIMEOUT =     0x0001;
-    int CLOSED =      0x0002;
-    int STDOUT_DATA = 0x0004;
-    int STDERR_DATA = 0x0008;
-    int EOF =         0x0010;
-    int EXIT_STATUS = 0x0020;
-    int EXIT_SIGNAL = 0x0040;
-    int OPENED =      0x0080;
-
-    enum Streaming {
-        Async,
-        Sync
-    }
-
-    Streaming getStreaming();
-
-    void setStreaming(Streaming streaming);
-
-    IoOutputStream getAsyncIn();
-
-    IoInputStream getAsyncOut();
-
-    IoInputStream getAsyncErr();
-
-    /**
-     * Access to an output stream to send data directly to the remote channel.
-     * This can be used instead of using {@link #setIn(java.io.InputStream)} method
-     * and having the channel polling for data in that stream.
-     *
-     * @return an OutputStream to be used to send data
-     */
-    OutputStream getInvertedIn();
-
-    InputStream getInvertedOut();
-
-    InputStream getInvertedErr();
-
-    /**
-     * Set an input stream that will be read by this channel and forwarded to
-     * the remote channel.  Note that using such a stream will create an additional
-     * thread for pumping the stream which will only be able to end when that stream
-     * is actually closed or some data is read.  It is recommended to use the
-     * {@link #getInvertedIn()} method instead and write data directly.
-     *
-     * @param in an InputStream to be polled and forwarded
-     */
-    void setIn(InputStream in);
-
-    void setOut(OutputStream out);
-
-    void setErr(OutputStream err);
-
-    OpenFuture open() throws IOException;
-
-    int waitFor(int mask, long timeout);
-
-    CloseFuture close(boolean immediately);
-
-    Integer getExitStatus();
-}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/9b98f342/sshd-core/src/main/java/org/apache/sshd/ClientSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/ClientSession.java b/sshd-core/src/main/java/org/apache/sshd/ClientSession.java
deleted file mode 100644
index e340210..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/ClientSession.java
+++ /dev/null
@@ -1,246 +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;
-
-import java.io.IOException;
-import java.nio.file.FileSystem;
-import java.security.KeyPair;
-import java.util.Map;
-
-import org.apache.sshd.client.ClientFactoryManager;
-import org.apache.sshd.client.UserInteraction;
-import org.apache.sshd.client.channel.ChannelDirectTcpip;
-import org.apache.sshd.client.channel.ChannelExec;
-import org.apache.sshd.client.channel.ChannelShell;
-import org.apache.sshd.client.channel.ChannelSubsystem;
-import org.apache.sshd.client.future.AuthFuture;
-import org.apache.sshd.client.scp.ScpClient;
-import org.apache.sshd.client.sftp.SftpClient;
-import org.apache.sshd.common.Session;
-import org.apache.sshd.common.SshdSocketAddress;
-import org.apache.sshd.common.future.CloseFuture;
-import org.apache.sshd.common.future.SshFuture;
-import org.apache.sshd.common.scp.ScpTransferEventListener;
-
-/**
- * An authenticated session to a given SSH server
- *
- * A client session is established using the {@link 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)}.
- *
- * From this session, channels can be created using the
- * {@link #createChannel(String)} method.  Multiple channels can
- * be created on a given session concurrently.
- *
- * 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.
- *
- * When a given session is no longer used, it must be closed using the
- * {@link #close(boolean)} method.
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public interface ClientSession extends Session {
-
-    int TIMEOUT =     0x0001;
-    int CLOSED =      0x0002;
-    int WAIT_AUTH =   0x0004;
-    int AUTHED =      0x0008;
-
-    void addPasswordIdentity(String password);
-    void addPublicKeyIdentity(KeyPair key);
-
-    UserInteraction getUserInteraction();
-    void setUserInteraction(UserInteraction userInteraction);
-
-    /**
-     * Starts the authentication process.
-     * User identities will be tried until the server successfully authenticate the user.
-     * User identities must be provided before calling this method using
-     * {@link #addPasswordIdentity(String)} or {@link #addPublicKeyIdentity(java.security.KeyPair)}.
-     *
-     * @return the authentication future
-     * @throws IOException
-     * @see #addPasswordIdentity(String)
-     * @see #addPublicKeyIdentity(java.security.KeyPair)
-     */
-    AuthFuture auth() throws IOException;
-
-    /**
-     * Create a channel of the given type.
-     * Same as calling <code>createChannel(type, null)</code>.
-     */
-    ClientChannel createChannel(String type) throws IOException;
-
-    /**
-     * Create a channel of the given type and subtype.
-     */
-    ClientChannel createChannel(String type, String subType) throws IOException;
-
-    /**
-     * Create a channel to start a shell.
-     */
-    ChannelShell createShellChannel() throws IOException;
-
-    /**
-     * Create a channel to execute a command.
-     */
-    ChannelExec createExecChannel(String command) throws IOException;
-
-    /**
-     * Create a subsystem channel.
-     */
-    ChannelSubsystem createSubsystemChannel(String subsystem) throws IOException;
-
-    /**
-     * Create a direct tcp-ip channel which can be used to stream data to a remote port from the server.
-     */
-    ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException;
-
-    /**
-     * 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)
-     */
-    ScpClient createScpClient();
-
-    /**
-     * 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)}
-     * @return An {@link ScpClient} instance
-     */
-    ScpClient createScpClient(ScpTransferEventListener listener);
-
-    /**
-     * @return The last {@link ScpTransferEventListener} set via
-     * {@link #setScpTransferEventListener(ScpTransferEventListener)}
-     */
-    ScpTransferEventListener getScpTransferEventListener();
-
-    /**
-     * @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
-     * @see #createScpClient(ScpTransferEventListener)
-     */
-    void setScpTransferEventListener(ScpTransferEventListener listener);
-
-    /**
-     * Create an SFTP client from this session.
-     */
-    SftpClient createSftpClient() throws IOException;
-
-    FileSystem createSftpFileSystem() throws IOException;
-    FileSystem createSftpFileSystem(int readBufferSize, int writeBufferSize) throws IOException;
-
-    /**
-     * Start forwarding the given local address on the client to the given address on the server.
-     */
-    SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException;
-
-    /**
-     * Stop forwarding the given local address.
-     */
-    void stopLocalPortForwarding(SshdSocketAddress local) throws IOException;
-
-    /**
-     * Start forwarding tcpip from the given address on the server to the
-     * given address on the client.
-     *
-     * 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>
-     * </ul>
-     *
-     */
-    SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException;
-
-    /**
-     * Stop forwarding of the given remote address.
-     */
-    void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException;
-
-    /**
-     * Start dynamic local port forwarding using a SOCKS proxy.
-     *
-     * @param local
-     * @return
-     * @throws IOException
-     */
-    SshdSocketAddress startDynamicPortForwarding(SshdSocketAddress local) throws IOException;
-
-    /**
-     * Stop a previously started dynamic port forwarding.
-     *
-     * @param local
-     * @throws IOException
-     */
-    void stopDynamicPortForwarding(SshdSocketAddress local) throws IOException;
-
-    /**
-     * Wait for a specific state.
-     */
-    int waitFor(int mask, long timeout);
-
-    /**
-     * Close this session.
-     */
-    @Override
-    CloseFuture close(boolean immediately);
-
-    /**
-     * Access to the metadata.
-     */
-    Map<Object, Object> getMetadataMap();
-
-    /**
-     * Return ClientFactoryManager for this session.
-     */
-    @Override
-    ClientFactoryManager getFactoryManager();
-
-    /**
-     * Switch to a none cipher for performance.
-     *
-     * 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
-     * @throws IOException if a key exchange is already running
-     */
-    SshFuture switchToNoneCipher() throws IOException;
-
-}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/9b98f342/sshd-core/src/main/java/org/apache/sshd/SshBuilder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/SshBuilder.java b/sshd-core/src/main/java/org/apache/sshd/SshBuilder.java
deleted file mode 100644
index d6c6298..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/SshBuilder.java
+++ /dev/null
@@ -1,506 +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;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.sshd.client.ServerKeyVerifier;
-import org.apache.sshd.client.kex.DHGClient;
-import org.apache.sshd.client.kex.DHGEXClient;
-import org.apache.sshd.client.keyverifier.AcceptAllServerKeyVerifier;
-import org.apache.sshd.common.AbstractFactoryManager;
-import org.apache.sshd.common.Channel;
-import org.apache.sshd.common.Cipher;
-import org.apache.sshd.common.Factory;
-import org.apache.sshd.common.ForwardingFilter;
-import org.apache.sshd.common.KeyExchange;
-import org.apache.sshd.common.Mac;
-import org.apache.sshd.common.NamedFactory;
-import org.apache.sshd.common.NamedFactory.Utils;
-import org.apache.sshd.common.Random;
-import org.apache.sshd.common.RequestHandler;
-import org.apache.sshd.common.Signature;
-import org.apache.sshd.common.TcpipForwarderFactory;
-import org.apache.sshd.common.Transformer;
-import org.apache.sshd.common.cipher.BuiltinCiphers;
-import org.apache.sshd.common.compression.BuiltinCompressions;
-import org.apache.sshd.common.compression.Compression;
-import org.apache.sshd.common.file.FileSystemFactory;
-import org.apache.sshd.common.file.nativefs.NativeFileSystemFactory;
-import org.apache.sshd.common.forward.DefaultTcpipForwarderFactory;
-import org.apache.sshd.common.forward.TcpipServerChannel;
-import org.apache.sshd.common.kex.BuiltinDHFactories;
-import org.apache.sshd.common.kex.DHFactory;
-import org.apache.sshd.common.mac.BuiltinMacs;
-import org.apache.sshd.common.random.BouncyCastleRandom;
-import org.apache.sshd.common.random.JceRandom;
-import org.apache.sshd.common.random.SingletonRandomFactory;
-import org.apache.sshd.common.session.ConnectionService;
-import org.apache.sshd.common.signature.BuiltinSignatures;
-import org.apache.sshd.common.util.ObjectBuilder;
-import org.apache.sshd.common.util.SecurityUtils;
-import org.apache.sshd.server.PublickeyAuthenticator;
-import org.apache.sshd.server.channel.ChannelSession;
-import org.apache.sshd.server.config.keys.DefaultAuthorizedKeysAuthenticator;
-import org.apache.sshd.server.global.CancelTcpipForwardHandler;
-import org.apache.sshd.server.global.KeepAliveHandler;
-import org.apache.sshd.server.global.NoMoreSessionsHandler;
-import org.apache.sshd.server.global.TcpipForwardHandler;
-import org.apache.sshd.server.kex.DHGEXServer;
-import org.apache.sshd.server.kex.DHGServer;
-
-/**
- * A builder object for creating SshServer instances.
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class SshBuilder {
-
-    public static ClientBuilder client() {
-        return new ClientBuilder();
-    }
-
-    public static ServerBuilder server() {
-        return new ServerBuilder();
-    }
-
-    /**
-     * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
-     */
-    public static class BaseBuilder<T extends AbstractFactoryManager, S extends BaseBuilder<T, S>> implements ObjectBuilder<T> {
-        protected Factory<T> factory;
-        protected List<NamedFactory<KeyExchange>> keyExchangeFactories;
-        protected List<NamedFactory<Cipher>> cipherFactories;
-        protected List<NamedFactory<Compression>> compressionFactories;
-        protected List<NamedFactory<Mac>> macFactories;
-        protected List<NamedFactory<Signature>> signatureFactories;
-        protected Factory<Random> randomFactory;
-        protected List<NamedFactory<Channel>> channelFactories;
-        protected FileSystemFactory fileSystemFactory;
-        protected TcpipForwarderFactory tcpipForwarderFactory;
-        protected List<RequestHandler<ConnectionService>> globalRequestHandlers;
-        protected ForwardingFilter forwardingFilter;
-
-        protected S fillWithDefaultValues() {
-            if (signatureFactories == null) {
-                signatureFactories = setUpDefaultSignatures(false);
-            }
-
-            if (randomFactory == null) {
-                if (SecurityUtils.isBouncyCastleRegistered()) {
-                    randomFactory = new SingletonRandomFactory(BouncyCastleRandom.BouncyCastleRandomFactory.INSTANCE);
-                } else {
-                    randomFactory = new SingletonRandomFactory(JceRandom.JceRandomFactory.INSTANCE);
-                }
-            }
-
-            if (cipherFactories == null) {
-                cipherFactories = setUpDefaultCiphers(false);
-            }
-
-            // Compression is not enabled by default
-            //if (compressionFactories == null) {
-            //    compressionFactories = Arrays.<NamedFactory<Compression>>asList(
-            //            new CompressionNone.Factory(),
-            //            new CompressionZlib.Factory(),
-            //            new CompressionDelayedZlib.Factory());
-            //}
-            if (compressionFactories == null) {
-                compressionFactories = Arrays.<NamedFactory<Compression>>asList(BuiltinCompressions.none);
-            }
-
-            if (macFactories == null) {
-                macFactories = setUpDefaultMacs(false);
-            }
-
-            if (fileSystemFactory == null) {
-                fileSystemFactory = new NativeFileSystemFactory();
-            }
-
-            if (forwardingFilter == null) {
-                forwardingFilter = ForwardingFilter.RejectAllForwardingFilter.INSTANCE;
-            }
-
-            if (tcpipForwarderFactory == null) {
-                tcpipForwarderFactory = new DefaultTcpipForwarderFactory();
-            }
-
-            return me();
-        }
-
-        public S keyExchangeFactories(List<NamedFactory<KeyExchange>> keyExchangeFactories) {
-            this.keyExchangeFactories = keyExchangeFactories;
-            return me();
-        }
-
-        public S signatureFactories(final List<NamedFactory<Signature>> signatureFactories) {
-            this.signatureFactories = signatureFactories;
-            return me();
-        }
-
-        public S randomFactory(final Factory<Random> randomFactory) {
-            this.randomFactory = randomFactory;
-            return me();
-        }
-
-        public S cipherFactories(final List<NamedFactory<Cipher>> cipherFactories) {
-            this.cipherFactories = cipherFactories;
-            return me();
-        }
-
-        public S compressionFactories(final List<NamedFactory<Compression>> compressionFactories) {
-            this.compressionFactories = compressionFactories;
-            return me();
-        }
-
-        public S macFactories(final List<NamedFactory<Mac>> macFactories) {
-            this.macFactories = macFactories;
-            return me();
-        }
-
-        public S channelFactories(final List<NamedFactory<Channel>> channelFactories) {
-            this.channelFactories = channelFactories;
-            return me();
-        }
-
-        public S fileSystemFactory(final FileSystemFactory fileSystemFactory) {
-            this.fileSystemFactory = fileSystemFactory;
-            return me();
-        }
-
-        public S forwardingFilter(final ForwardingFilter filter) {
-            this.forwardingFilter = filter;
-            return me();
-        }
-
-        public S tcpipForwarderFactory(final TcpipForwarderFactory tcpipForwarderFactory) {
-            this.tcpipForwarderFactory = tcpipForwarderFactory;
-            return me();
-        }
-
-        public S globalRequestHandlers(final List<RequestHandler<ConnectionService>> globalRequestHandlers) {
-            this.globalRequestHandlers = globalRequestHandlers;
-            return me();
-        }
-
-        public S factory(final Factory<T> factory) {
-            this.factory = factory;
-            return me();
-        }
-
-        public T build(final boolean isFillWithDefaultValues) {
-            if (isFillWithDefaultValues) {
-                fillWithDefaultValues();
-            }
-
-            T ssh = factory.create();
-
-            ssh.setKeyExchangeFactories(keyExchangeFactories);
-            ssh.setSignatureFactories(signatureFactories);
-            ssh.setRandomFactory(randomFactory);
-            ssh.setCipherFactories(cipherFactories);
-            ssh.setCompressionFactories(compressionFactories);
-            ssh.setMacFactories(macFactories);
-            ssh.setChannelFactories(channelFactories);
-            ssh.setFileSystemFactory(fileSystemFactory);
-            ssh.setTcpipForwardingFilter(forwardingFilter);
-            ssh.setTcpipForwarderFactory(tcpipForwarderFactory);
-            ssh.setGlobalRequestHandlers(globalRequestHandlers);
-            return ssh;
-        }
-
-        @Override
-        public T build() {
-            return build(true);
-        }
-
-        @SuppressWarnings("unchecked")
-        protected S me() {
-            return (S) this;
-        }
-
-        /**
-         * The default {@link BuiltinCiphers} setup in order of preference
-         * as specified by <A HREF="https://www.freebsd.org/cgi/man.cgi?query=ssh_config&sektion=5">
-         * ssh_config(5)</A> 
-         */
-        public static final List<BuiltinCiphers> DEFAULT_CIPHERS_PREFERENCE =
-                Collections.unmodifiableList(
-                        Arrays.asList(
-                                BuiltinCiphers.aes128ctr,
-                                BuiltinCiphers.aes192ctr,
-                                BuiltinCiphers.aes256ctr,
-                                BuiltinCiphers.arcfour256,
-                                BuiltinCiphers.arcfour128,
-                                BuiltinCiphers.aes128cbc,
-                                BuiltinCiphers.tripledescbc,
-                                BuiltinCiphers.blowfishcbc,
-                                // TODO add support for cast128-cbc cipher
-                                BuiltinCiphers.aes192cbc,
-                                BuiltinCiphers.aes256cbc
-                                // TODO add support for arcfour cipher
-                        ));
-        
-        /**
-         * @param ignoreUnsupported If {@code true} then all the default
-         * ciphers are included, regardless of whether they are currently
-         * supported by the JCE. Otherwise, only the supported ones out of the
-         * list are included
-         * @return A {@link List} of the default {@link NamedFactory}
-         * instances of the {@link Cipher}s according to the preference
-         * order defined by {@link #DEFAULT_CIPHERS_PREFERENCE}.
-         * <B>Note:</B> the list may be filtered to exclude unsupported JCE
-         * ciphers according to the <tt>ignoreUnsupported</tt> parameter
-         * @see BuiltinCiphers#isSupported()
-         */
-        public static List<NamedFactory<Cipher>> setUpDefaultCiphers(boolean ignoreUnsupported) {
-            return Utils.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_CIPHERS_PREFERENCE);
-        }
-        
-        /**
-         * The default {@link BuiltinDHFactories} setup in order of preference
-         * as specified by <A HREF="https://www.freebsd.org/cgi/man.cgi?query=ssh_config&sektion=5">
-         * ssh_config(5)</A> 
-         */
-        public static final List<BuiltinDHFactories> DEFAULT_KEX_PREFERENCE=
-                Collections.unmodifiableList(
-                        Arrays.asList(
-                                BuiltinDHFactories.ecdhp521,
-                                BuiltinDHFactories.ecdhp384,
-                                BuiltinDHFactories.ecdhp256,
-                                
-                                BuiltinDHFactories.dhgex256,
-                                BuiltinDHFactories.dhgex,
-                                
-                                BuiltinDHFactories.dhg14,
-                                BuiltinDHFactories.dhg1
-                        ));
-
-        /**
-         * The default {@link BuiltinMacs} setup in order of preference
-         * as specified by <A HREF="https://www.freebsd.org/cgi/man.cgi?query=ssh_config&sektion=5">
-         * ssh_config(5)</A> 
-         */
-        public static final List<BuiltinMacs>   DEFAULT_MAC_PREFERENCE=
-                Collections.unmodifiableList(
-                        Arrays.asList(
-                                BuiltinMacs.hmacmd5,
-                                BuiltinMacs.hmacsha1,
-                                BuiltinMacs.hmacsha256,
-                                BuiltinMacs.hmacsha512,
-                                BuiltinMacs.hmacsha196,
-                                BuiltinMacs.hmacmd596
-                        ));
-        /**
-         * @param ignoreUnsupported If {@code true} all the available built-in
-         * {@link Mac} factories are added, otherwise only those that are supported
-         * by the current JDK setup
-         * @return A {@link List} of the default {@link NamedFactory}
-         * instances of the {@link Mac}s according to the preference
-         * order defined by {@link #DEFAULT_MAC_PREFERENCE}.
-         * <B>Note:</B> the list may be filtered to exclude unsupported JCE
-         * MACs according to the <tt>ignoreUnsupported</tt> parameter
-         * @see BuiltinMacs#isSupported()
-         */
-        public static final List<NamedFactory<Mac>> setUpDefaultMacs(boolean ignoreUnsupported) {
-            return Utils.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_MAC_PREFERENCE);
-        }
-        
-        /**
-         * Preferred {@link BuiltinSignatures} according to
-         * <A HREF="https://www.freebsd.org/cgi/man.cgi?query=ssh_config&sektion=5>sshd_config(5)</A>
-         * {@code HostKeyAlgorithms} recommendation
-         */
-        public static final List<BuiltinSignatures> DEFAULT_SIGNATURE_PREFERENCE=
-                Collections.unmodifiableList(
-                        Arrays.asList(
-                                BuiltinSignatures.nistp256,
-                                BuiltinSignatures.nistp384,
-                                BuiltinSignatures.nistp521,
-                                BuiltinSignatures.rsa,
-                                BuiltinSignatures.dsa
-                        ));
-
-        /**
-         * @param ignoreUnsupported If {@code true} all the available built-in
-         * {@link Signature} factories are added, otherwise only those that are supported
-         * by the current JDK setup
-         * @return A {@link List} of the default {@link NamedFactory}
-         * instances of the {@link Signature}s according to the preference
-         * order defined by {@link #DEFAULT_SIGNATURE_PREFERENCE}.
-         * <B>Note:</B> the list may be filtered to exclude unsupported JCE
-         * signatures according to the <tt>ignoreUnsupported</tt> parameter
-         * @see BuiltinSignatures#isSupported()
-         */
-        public static final List<NamedFactory<Signature>> setUpDefaultSignatures(boolean ignoreUnsupported) {
-            return Utils.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_SIGNATURE_PREFERENCE);
-        }
-    }
-
-    /**
-     * SshClient builder
-     */
-    public static class ClientBuilder extends BaseBuilder<SshClient, ClientBuilder> {
-        public static final Transformer<DHFactory,NamedFactory<KeyExchange>> DH2KEX =
-                new Transformer<DHFactory, NamedFactory<KeyExchange>>() {
-                    @Override
-                    public NamedFactory<KeyExchange> transform(DHFactory factory) {
-                        if (factory == null) {
-                            return null;
-                        } else if (factory.isGroupExchange()) {
-                            return DHGEXClient.newFactory(factory);
-                        } else {
-                            return DHGClient.newFactory(factory);
-                        }
-                    }
-                };
-        protected ServerKeyVerifier serverKeyVerifier;
-
-        public ClientBuilder serverKeyVerifier(ServerKeyVerifier serverKeyVerifier) {
-            this.serverKeyVerifier = serverKeyVerifier;
-            return me();
-        }
-
-        @Override
-        protected ClientBuilder fillWithDefaultValues() {
-            super.fillWithDefaultValues();
-            if (keyExchangeFactories == null) {
-                keyExchangeFactories = setUpDefaultKeyExchanges(false);
-            }
-            if (channelFactories == null) {
-                channelFactories = Arrays.<NamedFactory<Channel>>asList(
-                        TcpipServerChannel.ForwardedTcpipFactory.INSTANCE);
-            }
-            if (serverKeyVerifier == null) {
-                serverKeyVerifier = AcceptAllServerKeyVerifier.INSTANCE;
-            }
-            if (factory == null) {
-                factory = SshClient.DEFAULT_SSH_CLIENT_FACTORY;
-            }
-            return me();
-        }
-
-        @Override
-        public SshClient build(boolean isFillWithDefaultValues) {
-            SshClient client = super.build(isFillWithDefaultValues);
-            client.setServerKeyVerifier(serverKeyVerifier);
-            return client;
-        }
-
-        /**
-         * @param ignoreUnsupported If {@code true} then all the default
-         * key exchanges are included, regardless of whether they are currently
-         * supported by the JCE. Otherwise, only the supported ones out of the
-         * list are included
-         * @return A {@link List} of the default {@link NamedFactory}
-         * instances of the {@link KeyExchange}s according to the preference
-         * order defined by {@link #DEFAULT_KEX_PREFERENCE}.
-         * <B>Note:</B> the list may be filtered to exclude unsupported JCE
-         * key exchanges according to the <tt>ignoreUnsupported</tt> parameter
-         * @see BuiltinDHFactories#isSupported()
-         */
-        public static List<NamedFactory<KeyExchange>> setUpDefaultKeyExchanges(boolean ignoreUnsupported) {
-            return NamedFactory.Utils.setUpTransformedFactories(ignoreUnsupported, DEFAULT_KEX_PREFERENCE, DH2KEX);
-        }
-    }
-
-    /**
-     * SshServer builder
-     */
-    public static class ServerBuilder extends BaseBuilder<SshServer, ServerBuilder> {
-        public static final Transformer<DHFactory,NamedFactory<KeyExchange>>    DH2KEX = 
-                new Transformer<DHFactory, NamedFactory<KeyExchange>>() {
-                    @Override
-                    public NamedFactory<KeyExchange> transform(DHFactory factory) {
-                        if (factory == null) {
-                            return null;
-                        } else if (factory.isGroupExchange()) {
-                            return DHGEXServer.newFactory(factory);
-                        } else {
-                            return DHGServer.newFactory(factory);
-                        }
-                    }
-                };
-
-        protected PublickeyAuthenticator pubkeyAuthenticator;
-
-        public ServerBuilder() {
-            super();
-        }
-
-        public ServerBuilder publickeyAuthenticator(PublickeyAuthenticator auth) {
-            pubkeyAuthenticator = auth;
-            return this;
-        }
-
-        @Override
-        protected ServerBuilder fillWithDefaultValues() {
-            super.fillWithDefaultValues();
-            if (keyExchangeFactories == null) {
-                keyExchangeFactories = setUpDefaultKeyExchanges(false);
-            }
-            if (channelFactories == null) {
-                channelFactories = Arrays.asList(
-                        ChannelSession.ChannelSessionFactory.INSTANCE,
-                        TcpipServerChannel.DirectTcpipFactory.INSTANCE);
-            }
-            if (globalRequestHandlers == null) {
-                globalRequestHandlers = Arrays.asList(
-                        new KeepAliveHandler(),
-                        new NoMoreSessionsHandler(),
-                        new TcpipForwardHandler(),
-                        new CancelTcpipForwardHandler());
-            }
-            if (factory == null) {
-                factory = SshServer.DEFAULT_SSH_SERVER_FACTORY;
-            }
-            
-            if (pubkeyAuthenticator == null) {
-                pubkeyAuthenticator = DefaultAuthorizedKeysAuthenticator.INSTANCE;
-            }
-
-            return me();
-        }
-
-        @Override
-        public SshServer build(boolean isFillWithDefaultValues) {
-            SshServer server = super.build(isFillWithDefaultValues);
-            server.setPublickeyAuthenticator(pubkeyAuthenticator);
-            return server;
-        }
-
-        /**
-         * @param ignoreUnsupported If {@code true} then all the default
-         * key exchanges are included, regardless of whether they are currently
-         * supported by the JCE. Otherwise, only the supported ones out of the
-         * list are included
-         * @return A {@link List} of the default {@link NamedFactory}
-         * instances of the {@link KeyExchange}s according to the preference
-         * order defined by {@link #DEFAULT_KEX_PREFERENCE}.
-         * <B>Note:</B> the list may be filtered to exclude unsupported JCE
-         * key exchanges according to the <tt>ignoreUnsupported</tt> parameter
-         * @see BuiltinDHFactories#isSupported()
-         */
-        public static List<NamedFactory<KeyExchange>> setUpDefaultKeyExchanges(boolean ignoreUnsupported) {
-            return NamedFactory.Utils.setUpTransformedFactories(ignoreUnsupported, DEFAULT_KEX_PREFERENCE, DH2KEX);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/9b98f342/sshd-core/src/main/java/org/apache/sshd/SshClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/SshClient.java b/sshd-core/src/main/java/org/apache/sshd/SshClient.java
deleted file mode 100644
index 37be6e5..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/SshClient.java
+++ /dev/null
@@ -1,557 +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;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Formatter;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-import org.apache.sshd.client.ClientFactoryManager;
-import org.apache.sshd.client.ServerKeyVerifier;
-import org.apache.sshd.client.SessionFactory;
-import org.apache.sshd.client.UserAuth;
-import org.apache.sshd.client.UserInteraction;
-import org.apache.sshd.client.auth.UserAuthKeyboardInteractive;
-import org.apache.sshd.client.auth.UserAuthPassword;
-import org.apache.sshd.client.auth.UserAuthPublicKey;
-import org.apache.sshd.client.channel.ChannelShell;
-import org.apache.sshd.client.future.ConnectFuture;
-import org.apache.sshd.client.future.DefaultConnectFuture;
-import org.apache.sshd.client.session.ClientConnectionService;
-import org.apache.sshd.client.session.ClientSessionImpl;
-import org.apache.sshd.client.session.ClientUserAuthService;
-import org.apache.sshd.common.AbstractFactoryManager;
-import org.apache.sshd.common.Channel;
-import org.apache.sshd.common.Closeable;
-import org.apache.sshd.common.Factory;
-import org.apache.sshd.common.NamedFactory;
-import org.apache.sshd.common.SshdSocketAddress;
-import org.apache.sshd.common.config.SshConfigFileReader;
-import org.apache.sshd.common.future.SshFutureListener;
-import org.apache.sshd.common.io.IoConnectFuture;
-import org.apache.sshd.common.io.IoConnector;
-import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
-import org.apache.sshd.common.keyprovider.KeyPairProvider;
-import org.apache.sshd.common.session.AbstractSession;
-import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.SecurityUtils;
-import org.apache.sshd.common.util.ValidateUtils;
-import org.apache.sshd.common.util.io.NoCloseInputStream;
-import org.apache.sshd.common.util.io.NoCloseOutputStream;
-import org.bouncycastle.openssl.PasswordFinder;
-
-/**
- * Entry point for the client side of the SSH protocol.
- *
- * The default configured client can be created using
- * the {@link #setUpDefaultClient()}.  The next step is to
- * start the client using the {@link #start()} method.
- *
- * Sessions can then be created using on of the
- * {@link #connect(String, String, int)} or {@link #connect(String, java.net.SocketAddress)}
- * methods.
- *
- * The client can be stopped at anytime using the {@link #stop()} method.
- *
- * Following is an example of using the SshClient:
- * <pre>
- *    SshClient client = SshClient.setUpDefaultClient();
- *    client.start();
- *    try {
- *        ClientSession session = client.connect(login, host, port).await().getSession();
- *        session.addPasswordIdentity(password);
- *        session.auth().verify();
- *
- *        ClientChannel channel = session.createChannel("shell");
- *        channel.setIn(new NoCloseInputStream(System.in));
- *        channel.setOut(new NoCloseOutputStream(System.out));
- *        channel.setErr(new NoCloseOutputStream(System.err));
- *        channel.open();
- *        channel.waitFor(ClientChannel.CLOSED, 0);
- *        session.close(false);
- *    } finally {
- *        client.stop();
- *    }
- * </pre>
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class SshClient extends AbstractFactoryManager implements ClientFactoryManager, Closeable {
-
-    public static final Factory<SshClient> DEFAULT_SSH_CLIENT_FACTORY = new Factory<SshClient>() {
-        @Override
-        public SshClient create() {
-            return new SshClient();
-        }
-    };
-
-    protected IoConnector connector;
-    protected SessionFactory sessionFactory;
-    protected UserInteraction userInteraction;
-    protected List<NamedFactory<UserAuth>> userAuthFactories;
-
-    private ServerKeyVerifier serverKeyVerifier;
-
-    public SshClient() {
-    }
-
-    public SessionFactory getSessionFactory() {
-        return sessionFactory;
-    }
-
-    public void setSessionFactory(SessionFactory sessionFactory) {
-        this.sessionFactory = sessionFactory;
-    }
-
-    @Override
-    public ServerKeyVerifier getServerKeyVerifier() {
-        return serverKeyVerifier;
-    }
-
-    public void setServerKeyVerifier(ServerKeyVerifier serverKeyVerifier) {
-        this.serverKeyVerifier = serverKeyVerifier;
-    }
-
-    @Override
-    public UserInteraction getUserInteraction() {
-        return userInteraction;
-    }
-
-    public void setUserInteraction(UserInteraction userInteraction) {
-        this.userInteraction = userInteraction;
-    }
-
-    @Override
-    public List<NamedFactory<UserAuth>> getUserAuthFactories() {
-        return userAuthFactories;
-    }
-
-    public void setUserAuthFactories(List<NamedFactory<UserAuth>> userAuthFactories) {
-        this.userAuthFactories = userAuthFactories;
-    }
-
-    @Override
-    protected void checkConfig() {
-        super.checkConfig();
-        
-        ValidateUtils.checkNotNull(getTcpipForwarderFactory(), "TcpipForwarderFactory not set", GenericUtils.EMPTY_OBJECT_ARRAY);
-        ValidateUtils.checkNotNull(getServerKeyVerifier(), "ServerKeyVerifier not set", GenericUtils.EMPTY_OBJECT_ARRAY);
-
-        // Register the additional agent forwarding channel if needed
-        if (getAgentFactory() != null) {
-            List<NamedFactory<Channel>> factories = getChannelFactories();
-            if (GenericUtils.isEmpty(factories)) {
-                factories = new ArrayList<NamedFactory<Channel>>();
-            } else {
-                factories = new ArrayList<NamedFactory<Channel>>(factories);
-            }
-            factories.add(getAgentFactory().getChannelForwardingFactory());
-            setChannelFactories(factories);
-        }
-
-        if (GenericUtils.isEmpty(getServiceFactories())) {
-            setServiceFactories(Arrays.asList(
-                    new ClientUserAuthService.Factory(),
-                    new ClientConnectionService.Factory()
-            ));
-        }
-
-        if (GenericUtils.isEmpty(getUserAuthFactories())) {
-            setUserAuthFactories(Arrays.asList(
-                    UserAuthPublicKey.UserAuthPublicKeyFactory.INSTANCE,
-                    UserAuthKeyboardInteractive.UserAuthKeyboardInteractiveFactory.INSTANCE,
-                    UserAuthPassword.UserAuthPasswordFactory.INSTANCE
-            ));
-        }
-    }
-
-    public void start() {
-        checkConfig();
-        if (sessionFactory == null) {
-            sessionFactory = createSessionFactory();
-        }
-
-        setupSessionTimeout(sessionFactory);
-
-        sessionFactory.setClient(this);
-        connector = createConnector();
-    }
-
-    public void stop() {
-        try {
-            close(true).await();
-        } catch (InterruptedException e) {
-            log.debug("Exception caught while stopping client", e);
-        }
-    }
-
-    public void open() throws IOException {
-        start();
-    }
-
-    @Override
-    protected Closeable getInnerCloseable() {
-        return builder()
-                .run(new Runnable() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public void run() {
-                        removeSessionTimeout(sessionFactory);
-                    }
-                })
-                .sequential(connector, ioServiceFactory)
-                .run(new Runnable() {
-                    @SuppressWarnings("synthetic-access")
-                    @Override
-                    public void run() {
-                        connector = null;
-                        ioServiceFactory = null;
-                        if (shutdownExecutor && (executor != null) && (!executor.isShutdown())) {
-                            try {
-                                executor.shutdownNow();
-                            } finally {
-                                executor = null;
-                            }
-                        }
-                    }
-                })
-                .build();
-    }
-
-    public ConnectFuture connect(String username, String host, int port) throws IOException {
-        assert host != null;
-        assert port >= 0;
-        if (connector == null) {
-            throw new IllegalStateException("SshClient not started. Please call start() method before connecting to a server");
-        }
-        SocketAddress address = new InetSocketAddress(host, port);
-        return connect(username, address);
-    }
-
-    public ConnectFuture connect(final String username, SocketAddress address) {
-        assert address != null;
-        if (connector == null) {
-            throw new IllegalStateException("SshClient not started. Please call start() method before connecting to a server");
-        }
-        final ConnectFuture connectFuture = new DefaultConnectFuture(null);
-        connector.connect(address).addListener(new SshFutureListener<IoConnectFuture>() {
-            @Override
-            public void operationComplete(IoConnectFuture future) {
-                if (future.isCanceled()) {
-                    connectFuture.cancel();
-                } else if (future.getException() != null) {
-                    connectFuture.setException(future.getException());
-                } else {
-                    ClientSessionImpl session = (ClientSessionImpl) AbstractSession.getSession(future.getSession());
-                    session.setUsername(username);
-                    connectFuture.setSession(session);
-                }
-            }
-        });
-        return connectFuture;
-    }
-
-    protected IoConnector createConnector() {
-        return getIoServiceFactory().createConnector(getSessionFactory());
-    }
-
-    protected SessionFactory createSessionFactory() {
-        return new SessionFactory();
-    }
-
-    @Override
-    public String toString() {
-        return "SshClient[" + Integer.toHexString(hashCode()) + "]";
-    }
-
-    /**
-     * Setup a default client.  The client does not require any additional setup.
-     *
-     * @return a newly create SSH client
-     */
-    public static SshClient setUpDefaultClient() {
-        return SshBuilder.client().build();
-    }
-
-    /*=================================
-          Main class implementation
-     *=================================*/
-
-    public static void main(String[] args) throws Exception {
-        Handler fh = new ConsoleHandler();
-        fh.setLevel(Level.FINEST);
-        fh.setFormatter(new Formatter() {
-            @Override
-            public String format(LogRecord record) {
-                String message = formatMessage(record);
-                String throwable = "";
-                if (record.getThrown() != null) {
-                    StringWriter sw = new StringWriter();
-                    PrintWriter pw = new PrintWriter(sw);
-                    pw.println();
-                    record.getThrown().printStackTrace(pw);
-                    pw.close();
-                    throwable = sw.toString();
-                }
-                return String.format("%1$tY-%1$tm-%1$td: %2$-7.7s: %3$-32.32s: %4$s%5$s%n",
-                        new Date(record.getMillis()),
-                        record.getLevel().getName(),
-                        record.getLoggerName(),
-                        message,
-                        throwable);
-            }
-        });
-        Logger root = Logger.getLogger("");
-        for (Handler handler : root.getHandlers()) {
-            root.removeHandler(handler);
-        }
-        root.addHandler(fh);
-
-        int port = SshConfigFileReader.DEFAULT_PORT;
-        String host = null;
-        String login = System.getProperty("user.name");
-        boolean agentForward = false;
-        List<String> command = null;
-        int logLevel = 0;
-        int socksPort = -1;
-        boolean error = false;
-        List<String> identities = new ArrayList<String>();
-        Map<String, String> options = new LinkedHashMap<String, String>();
-
-        for (int i = 0; i < args.length; i++) {
-            if (command == null && "-p".equals(args[i])) {
-                if (i + 1 >= args.length) {
-                    System.err.println("option requires an argument: " + args[i]);
-                    error = true;
-                    break;
-                }
-                port = Integer.parseInt(args[++i]);
-            } else if (command == null && "-D".equals(args[i])) {
-                if (i + 1 >= args.length) {
-                    System.err.println("option requires an argument: " + args[i]);
-                    error = true;
-                    break;
-                }
-                socksPort = Integer.parseInt(args[++i]);
-            } else if (command == null && "-l".equals(args[i])) {
-                if (i + 1 >= args.length) {
-                    System.err.println("option requires an argument: " + args[i]);
-                    error = true;
-                    break;
-                }
-                login = args[++i];
-            } else if (command == null && "-v".equals(args[i])) {
-                logLevel += 1;
-            } else if (command == null && "-vv".equals(args[i])) {
-                logLevel += 2;
-            } else if (command == null && "-vvv".equals(args[i])) {
-                logLevel += 3;
-            } else if (command == null && "-A".equals(args[i])) {
-                agentForward = true;
-            } else if (command == null && "-a".equals(args[i])) {
-                agentForward = false;
-            } else if (command == null && "-i".equals(args[i])) {
-                if (i + 1 >= args.length) {
-                    System.err.println("option requires and argument: " + args[i]);
-                    error = true;
-                    break;
-                }
-                identities.add(args[++i]);
-            } else if (command == null && "-o".equals(args[i])) {
-                if (i + 1 >= args.length) {
-                    System.err.println("option requires and argument: " + args[i]);
-                    error = true;
-                    break;
-                }
-                String opt = args[++i];
-                int idx = opt.indexOf('=');
-                if (idx <= 0) {
-                    System.err.println("bad syntax for option: " + opt);
-                    error = true;
-                    break;
-                }
-                options.put(opt.substring(0, idx), opt.substring(idx + 1));
-            } else if (command == null && args[i].startsWith("-")) {
-                System.err.println("illegal option: " + args[i]);
-                error = true;
-                break;
-            } else {
-                if (command == null && host == null) {
-                    host = args[i];
-                } else {
-                    if (command == null) {
-                        command = new ArrayList<String>();
-                    }
-                    command.add(args[i]);
-                }
-            }
-        }
-        if (host == null) {
-            System.err.println("hostname required");
-            error = true;
-        }
-        if (error) {
-            System.err.println("usage: ssh [-A|-a] [-v[v][v]] [-D socksPort] [-l login] [-p port] [-o option=value] hostname [command]");
-            System.exit(-1);
-        }
-        if (logLevel <= 0) {
-            root.setLevel(Level.WARNING);
-        } else if (logLevel == 1) {
-            root.setLevel(Level.INFO);
-        } else if (logLevel == 2) {
-            root.setLevel(Level.FINE);
-        } else {
-            root.setLevel(Level.FINEST);
-        }
-
-        KeyPairProvider provider = null;
-        final List<String> files = new ArrayList<String>();
-        File f = new File(System.getProperty("user.home"), ".ssh/id_dsa");
-        if (f.exists() && f.isFile() && f.canRead()) {
-            files.add(f.getAbsolutePath());
-        }
-        f = new File(System.getProperty("user.home"), ".ssh/id_rsa");
-        if (f.exists() && f.isFile() && f.canRead()) {
-            files.add(f.getAbsolutePath());
-        }
-        f = new File(System.getProperty("user.home"), ".ssh/id_ecdsa");
-        if (f.exists() && f.isFile() && f.canRead()) {
-            files.add(f.getAbsolutePath());
-        }
-        if (files.size() > 0) {
-            // SSHD-292: we need to use a different class to load the FileKeyPairProvider
-            //  in order to break the link between SshClient and BouncyCastle
-            try {
-                if (SecurityUtils.isBouncyCastleRegistered()) {
-                    class KeyPairProviderLoader implements Callable<KeyPairProvider> {
-                        @Override
-                        public KeyPairProvider call() throws Exception {
-                            return new FileKeyPairProvider(files.toArray(new String[files.size()]), new PasswordFinder() {
-                                @Override
-                                public char[] getPassword() {
-                                    try {
-                                        System.out.println("Enter password for private key: ");
-                                        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
-                                        String password = r.readLine();
-                                        return password.toCharArray();
-                                    } catch (IOException e) {
-                                        return null;
-                                    }
-                                }
-                            });
-                        }
-                    }
-                    provider = new KeyPairProviderLoader().call();
-                }
-            } catch (Throwable t) {
-                System.out.println("Error loading user keys: " + t.getMessage());
-            }
-        }
-
-        SshClient client = SshClient.setUpDefaultClient();
-        Map<String,Object> props = client.getProperties();
-        props.putAll(options);
-
-        client.start();
-        client.setKeyPairProvider(provider);
-        client.setUserInteraction(new UserInteraction() {
-            @Override
-            public void welcome(String banner) {
-                System.out.println(banner);
-            }
-
-            @Override
-            public String[] interactive(String destination, String name, String instruction, String[] prompt, boolean[] echo) {
-                String[] answers = new String[prompt.length];
-                try {
-                    for (int i = 0; i < prompt.length; i++) {
-                        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
-                        System.out.print(prompt[i] + " ");
-                        answers[i] = r.readLine();
-                    }
-                } catch (IOException e) {
-                    // ignored
-                }
-                return answers;
-            }
-        });
-
-        /*
-        String authSock = System.getenv(SshAgent.SSH_AUTHSOCKET_ENV_NAME);
-        if (authSock == null && provider != null) {
-            Iterable<KeyPair> keys = provider.loadKeys();
-            AgentServer server = new AgentServer();
-            authSock = server.start();
-            SshAgent agent = new AgentClient(authSock);
-            for (KeyPair key : keys) {
-                agent.addIdentity(key, "");
-            }
-            agent.close();
-            props.put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, authSock);
-        }
-        */
-
-        ClientSession session = client.connect(login, host, port).await().getSession();
-        session.auth().verify();
-
-        if (socksPort >= 0) {
-            session.startDynamicPortForwarding(new SshdSocketAddress("localhost", socksPort));
-            Thread.sleep(Long.MAX_VALUE);
-        } else {
-            ClientChannel channel;
-            if (command == null) {
-                channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
-                ((ChannelShell) channel).setAgentForwarding(agentForward);
-                channel.setIn(new NoCloseInputStream(System.in));
-            } else {
-                StringWriter w = new StringWriter();
-                for (String cmd : command) {
-                    w.append(cmd).append(" ");
-                }
-                w.close();
-                channel = session.createChannel(ClientChannel.CHANNEL_EXEC, w.toString());
-            }
-            channel.setOut(new NoCloseOutputStream(System.out));
-            channel.setErr(new NoCloseOutputStream(System.err));
-            channel.open().await();
-            channel.waitFor(ClientChannel.CLOSED, 0);
-            session.close(false);
-            client.stop();
-        }
-    }
-
-}