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 2016/08/04 17:06:35 UTC

[3/3] mina-sshd git commit: [SSHD-687] Provide indication of the negotiated options before processing them

[SSHD-687] Provide indication of the negotiated options before processing them


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

Branch: refs/heads/master
Commit: 997ae449f36fb90dd1e055b28decf4f089332646
Parents: 25bc715
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Thu Aug 4 20:07:59 2016 +0300
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Thu Aug 4 20:07:59 2016 +0300

----------------------------------------------------------------------
 .../java/org/apache/sshd/client/SshKeyScan.java |  17 +++
 .../client/auth/keyboard/UserInteraction.java   |  18 +--
 .../sshd/common/channel/ChannelListener.java    |  27 +++-
 .../forward/PortForwardingEventListener.java    |  48 +++++--
 .../common/scp/ScpTransferEventListener.java    |  40 +++---
 .../sshd/common/session/SessionListener.java    |  49 ++++++-
 .../common/session/helpers/AbstractSession.java |  70 +++++-----
 .../subsystem/sftp/SftpEventListener.java       | 128 +++++++++++++------
 .../java/org/apache/sshd/KeyReExchangeTest.java |  45 -------
 .../client/ClientAuthenticationManagerTest.java |  76 +----------
 .../sshd/client/ClientSessionListenerTest.java  |  30 -----
 .../java/org/apache/sshd/client/ClientTest.java |  10 --
 .../client/simple/SimpleSessionClientTest.java  |  15 ---
 .../sshd/common/auth/AuthenticationTest.java    |  55 --------
 .../common/compression/CompressionTest.java     |  15 ---
 .../ReservedSessionMessagesHandlerTest.java     |  15 ---
 .../sshd/server/ServerProxyAcceptorTest.java    |  10 --
 .../sshd/server/ServerSessionListenerTest.java  |  37 +-----
 .../java/org/apache/sshd/server/ServerTest.java |  67 +---------
 19 files changed, 272 insertions(+), 500 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java b/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
index 2d85c4a..dfd8977 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/SshKeyScan.java
@@ -360,6 +360,23 @@ public class SshKeyScan extends AbstractSimplifiedLog
         logSessionEvent(session, "Closed");
     }
 
+    @Override
+    public void sessionNegotiationStart(
+            Session session, Map<KexProposalOption, String> clientProposal, Map<KexProposalOption, String> serverProposal) {
+        logSessionEvent(session, "sessionNegotiationStart");
+    }
+
+    @Override
+    public void sessionNegotiationEnd(Session session, Map<KexProposalOption, String> clientProposal,
+            Map<KexProposalOption, String> serverProposal, Map<KexProposalOption, String> negotiatedOptions,
+            Throwable reason) {
+        if (reason == null) {
+            logSessionEvent(session, "sessionNegotiationStart");
+        } else {
+            logSessionEvent(session, reason);
+        }
+    }
+
     protected void logSessionEvent(Session session, Object event) {
         if (isEnabled(Level.FINEST)) {
             IoSession ioSession = session.getIoSession();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserInteraction.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserInteraction.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserInteraction.java
index 973bce4..a641243 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserInteraction.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/keyboard/UserInteraction.java
@@ -41,16 +41,6 @@ public interface UserInteraction {
         }
 
         @Override
-        public void serverVersionInfo(ClientSession session, List<String> lines) {
-            // ignored
-        }
-
-        @Override
-        public void welcome(ClientSession session, String banner, String lang) {
-            // ignored
-        }
-
-        @Override
         public String[] interactive(ClientSession session, String name, String instruction, String lang, String[] prompt, boolean[] echo) {
             throw new IllegalStateException("interactive(" + session + ")[" + name + "] unexpected call");
         }
@@ -82,7 +72,9 @@ public interface UserInteraction {
      * @param lines The sent extra lines - <U>without</U> the server version
      * @see <A HREF="https://tools.ietf.org/html/rfc4253#section-4.2">RFC 4253 - section 4.2</A>
      */
-    void serverVersionInfo(ClientSession session, List<String> lines);
+    default void serverVersionInfo(ClientSession session, List<String> lines) {
+        // do nothing
+    }
 
     /**
      * Displays the welcome banner to the user.
@@ -91,7 +83,9 @@ public interface UserInteraction {
      * @param banner  The welcome banner
      * @param lang    The banner language code - may be empty
      */
-    void welcome(ClientSession session, String banner, String lang);
+    default void welcome(ClientSession session, String banner, String lang) {
+        // do nothing
+    }
 
     /**
      * Invoked when &quot;keyboard-interactive&quot; authentication mechanism

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelListener.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelListener.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelListener.java
index e965487..20eb29d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelListener.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelListener.java
@@ -30,6 +30,13 @@ import java.util.EventListener;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public interface ChannelListener extends EventListener {
+    ChannelListener EMPTY = new ChannelListener() {
+        @Override
+        public String toString() {
+            return "EMPTY";
+        }
+    };
+
     /**
      * Called to inform about initial setup of a channel via the
      * {@link Channel#init(org.apache.sshd.common.session.ConnectionService, org.apache.sshd.common.session.Session, int)}
@@ -39,7 +46,9 @@ public interface ChannelListener extends EventListener {
      *
      * @param channel The initialized {@link Channel}
      */
-    void channelInitialized(Channel channel);
+    default void channelInitialized(Channel channel) {
+        // ignored
+    }
 
     /**
      * Called to inform about a channel being successfully opened for a
@@ -48,7 +57,9 @@ public interface ChannelListener extends EventListener {
      *
      * @param channel The newly opened {@link Channel}
      */
-    void channelOpenSuccess(Channel channel);
+    default void channelOpenSuccess(Channel channel) {
+        // ignored
+    }
 
     /**
      * Called to inform about the failure to open a channel
@@ -58,7 +69,9 @@ public interface ChannelListener extends EventListener {
      * {@link #channelOpenSuccess(Channel)} notification throws an exception
      * it will cause this method to be invoked
      */
-    void channelOpenFailure(Channel channel, Throwable reason);
+    default void channelOpenFailure(Channel channel, Throwable reason) {
+        // ignored
+    }
 
     /**
      * Called to inform that the channel state may have changed - e.g.,
@@ -68,7 +81,9 @@ public interface ChannelListener extends EventListener {
      * @param hint A &quot;hint&quot; as to the nature of the state change.
      * it can be a request name or a {@code SSH_MSG_CHANNEL_XXX} command
      */
-    void channelStateChanged(Channel channel, String hint);
+    default void channelStateChanged(Channel channel, String hint) {
+        // ignored
+    }
 
     /**
      * Called to inform about a channel being closed. <B>Note:</B> when the call
@@ -82,5 +97,7 @@ public interface ChannelListener extends EventListener {
      * @param reason The reason why the channel is being closed - if {@code null}
      * then normal closure
      */
-    void channelClosed(Channel channel, Throwable reason);
+    default void channelClosed(Channel channel, Throwable reason) {
+        // ignored
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/main/java/org/apache/sshd/common/forward/PortForwardingEventListener.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/PortForwardingEventListener.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/PortForwardingEventListener.java
index d03dbd9..25211bb 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/PortForwardingEventListener.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/PortForwardingEventListener.java
@@ -29,6 +29,13 @@ import org.apache.sshd.common.util.net.SshdSocketAddress;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public interface PortForwardingEventListener extends EventListener {
+    PortForwardingEventListener EMPTY = new PortForwardingEventListener() {
+        @Override
+        public String toString() {
+            return "EMPTY";
+        }
+    };
+
     /**
      * Signals the attempt to establish a local/remote port forwarding
      *
@@ -39,9 +46,11 @@ public interface PortForwardingEventListener extends EventListener {
      * @throws IOException If failed to handle the event - in which case
      * the attempt is aborted and the exception re-thrown to the caller
      */
-    void establishingExplicitTunnel(
+    default void establishingExplicitTunnel(
             Session session, SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding)
-                    throws IOException;
+                    throws IOException {
+                        // ignored
+    }
 
     /**
      * Signals a successful/failed attempt to establish a local/remote port forwarding
@@ -55,10 +64,12 @@ public interface PortForwardingEventListener extends EventListener {
      * @throws IOException If failed to handle the event - in which case
      * the established tunnel is aborted
      */
-    void establishedExplicitTunnel(
+    default void establishedExplicitTunnel(
             Session session, SshdSocketAddress local, SshdSocketAddress remote, boolean localForwarding,
             SshdSocketAddress boundAddress, Throwable reason)
-                    throws IOException;
+                    throws IOException {
+                        // ignored
+    }
 
     /**
      * Signals a request to tear down a local/remote port forwarding
@@ -69,7 +80,10 @@ public interface PortForwardingEventListener extends EventListener {
      * @throws IOException If failed to handle the event - in which case
      * the request is aborted
      */
-    void tearingDownExplicitTunnel(Session session, SshdSocketAddress address, boolean localForwarding) throws IOException;
+    default void tearingDownExplicitTunnel(Session session, SshdSocketAddress address, boolean localForwarding)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Signals a successful/failed request to tear down a local/remote port forwarding
@@ -82,7 +96,10 @@ public interface PortForwardingEventListener extends EventListener {
      * the exception is propagated, but the port forwarding may have
      * been torn down - no rollback
      */
-    void tornDownExplicitTunnel(Session session, SshdSocketAddress address, boolean localForwarding, Throwable reason) throws IOException;
+    default void tornDownExplicitTunnel(Session session, SshdSocketAddress address, boolean localForwarding, Throwable reason)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Signals the attempt to establish a dynamic port forwarding
@@ -92,7 +109,9 @@ public interface PortForwardingEventListener extends EventListener {
      * @throws IOException If failed to handle the event - in which case
      * the attempt is aborted and the exception re-thrown to the caller
      */
-    void establishingDynamicTunnel(Session session, SshdSocketAddress local) throws IOException;
+    default void establishingDynamicTunnel(Session session, SshdSocketAddress local) throws IOException {
+        // ignored
+    }
 
     /**
      * Signals a successful/failed attempt to establish a dynamic port forwarding
@@ -104,9 +123,11 @@ public interface PortForwardingEventListener extends EventListener {
      * @throws IOException If failed to handle the event - in which case
      * the established tunnel is aborted
      */
-    void establishedDynamicTunnel(
+    default void establishedDynamicTunnel(
             Session session, SshdSocketAddress local, SshdSocketAddress boundAddress, Throwable reason)
-                    throws IOException;
+                    throws IOException {
+                        // ignored
+    }
 
     /**
      * Signals a request to tear down a dynamic forwarding
@@ -116,7 +137,9 @@ public interface PortForwardingEventListener extends EventListener {
      * @throws IOException If failed to handle the event - in which case
      * the request is aborted
      */
-    void tearingDownDynamicTunnel(Session session, SshdSocketAddress address) throws IOException;
+    default void tearingDownDynamicTunnel(Session session, SshdSocketAddress address) throws IOException {
+        // ignored
+    }
 
     /**
      * Signals a successful/failed request to tear down a dynamic port forwarding
@@ -128,6 +151,7 @@ public interface PortForwardingEventListener extends EventListener {
      * the exception is propagated, but the port forwarding may have
      * been torn down - no rollback
      */
-    void tornDownDynamicTunnel(Session session, SshdSocketAddress address, Throwable reason) throws IOException;
-
+    default void tornDownDynamicTunnel(Session session, SshdSocketAddress address, Throwable reason) throws IOException {
+        // ignored
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java
index ebe2787..95380cd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/scp/ScpTransferEventListener.java
@@ -31,7 +31,6 @@ import java.util.Set;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public interface ScpTransferEventListener extends EventListener {
-
     enum FileOperation {
         SEND,
         RECEIVE
@@ -41,26 +40,9 @@ public interface ScpTransferEventListener extends EventListener {
      * An &quot;empty&quot; implementation to be used instead of {@code null}s
      */
     ScpTransferEventListener EMPTY = new ScpTransferEventListener() {
-        // TODO in JDK 8.0 implement all methods as default with empty body in the interface itself
-
-        @Override
-        public void startFileEvent(FileOperation op, Path file, long length, Set<PosixFilePermission> perms) {
-            // ignored
-        }
-
-        @Override
-        public void endFileEvent(FileOperation op, Path file, long length, Set<PosixFilePermission> perms, Throwable thrown) {
-            // ignored
-        }
-
         @Override
-        public void startFolderEvent(FileOperation op, Path file, Set<PosixFilePermission> perms) {
-            // ignored
-        }
-
-        @Override
-        public void endFolderEvent(FileOperation op, Path file, Set<PosixFilePermission> perms, Throwable thrown) {
-            // ignored
+        public String toString() {
+            return "EMPTY";
         }
     };
 
@@ -72,7 +54,9 @@ public interface ScpTransferEventListener extends EventListener {
      *               once transfer is complete
      * @throws IOException If failed to handle the event
      */
-    void startFileEvent(FileOperation op, Path file, long length, Set<PosixFilePermission> perms) throws IOException;
+    default void startFileEvent(FileOperation op, Path file, long length, Set<PosixFilePermission> perms) throws IOException {
+        // ignored
+    }
 
     /**
      * @param op     The {@link FileOperation}
@@ -84,7 +68,10 @@ public interface ScpTransferEventListener extends EventListener {
      *               reception was successful
      * @throws IOException If failed to handle the event
      */
-    void endFileEvent(FileOperation op, Path file, long length, Set<PosixFilePermission> perms, Throwable thrown) throws IOException;
+    default void endFileEvent(FileOperation op, Path file, long length, Set<PosixFilePermission> perms, Throwable thrown)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * @param op    The {@link FileOperation}
@@ -93,7 +80,9 @@ public interface ScpTransferEventListener extends EventListener {
      *              once transfer is complete
      * @throws IOException If failed to handle the event
      */
-    void startFolderEvent(FileOperation op, Path file, Set<PosixFilePermission> perms) throws IOException;
+    default void startFolderEvent(FileOperation op, Path file, Set<PosixFilePermission> perms) throws IOException {
+        // ignored
+    }
 
     /**
      * @param op     The {@link FileOperation}
@@ -104,5 +93,8 @@ public interface ScpTransferEventListener extends EventListener {
      *               reception was successful
      * @throws IOException If failed to handle the event
      */
-    void endFolderEvent(FileOperation op, Path file, Set<PosixFilePermission> perms, Throwable thrown) throws IOException;
+    default void endFolderEvent(FileOperation op, Path file, Set<PosixFilePermission> perms, Throwable thrown)
+            throws IOException {
+        // ignored
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/main/java/org/apache/sshd/common/session/SessionListener.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/SessionListener.java b/sshd-core/src/main/java/org/apache/sshd/common/session/SessionListener.java
index 3a6fe18..e4267dc 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/SessionListener.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/SessionListener.java
@@ -19,6 +19,9 @@
 package org.apache.sshd.common.session;
 
 import java.util.EventListener;
+import java.util.Map;
+
+import org.apache.sshd.common.kex.KexProposalOption;
 
 /**
  * Represents an interface receiving session events.
@@ -26,7 +29,6 @@ import java.util.EventListener;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public interface SessionListener extends EventListener {
-
     enum Event {
         KeyEstablished, Authenticated, KexCompleted
     }
@@ -36,7 +38,37 @@ public interface SessionListener extends EventListener {
      *
      * @param session The created {@link Session}
      */
-    void sessionCreated(Session session);
+    default void sessionCreated(Session session) {
+        // ignored
+    }
+
+    /**
+     * Signals the start of the negotiation options handling
+     *
+     * @param session The referenced {@link Session}
+     * @param clientProposal The client proposal options (un-modifiable)
+     * @param serverProposal The server proposal options (un-modifiable)
+     */
+    default void sessionNegotiationStart(Session session,
+            Map<KexProposalOption, String> clientProposal, Map<KexProposalOption, String> serverProposal) {
+        // ignored
+    }
+
+    /**
+     * Signals the end of the negotiation options handling
+     *
+     * @param session The referenced {@link Session}
+     * @param clientProposal The client proposal options (un-modifiable)
+     * @param serverProposal The server proposal options (un-modifiable)
+     * @param negotiatedOptions The successfully negotiated options so far
+     * - even if exception occurred (un-modifiable)
+     * @param reason Negotiation end reason - {@code null} if successful
+     */
+    default void sessionNegotiationEnd(Session session,
+            Map<KexProposalOption, String> clientProposal, Map<KexProposalOption, String> serverProposal,
+            Map<KexProposalOption, String> negotiatedOptions, Throwable reason) {
+        // ignored
+    }
 
     /**
      * An event has been triggered
@@ -44,7 +76,9 @@ public interface SessionListener extends EventListener {
      * @param session The referenced {@link Session}
      * @param event The generated {@link Event}
      */
-    void sessionEvent(Session session, Event event);
+    default void sessionEvent(Session session, Event event) {
+        // ignored
+    }
 
     /**
      * An exception was caught and the session will be closed
@@ -55,13 +89,16 @@ public interface SessionListener extends EventListener {
      * @param session The referenced {@link Session}
      * @param t The caught exception
      */
-    void sessionException(Session session, Throwable t);
+    default void sessionException(Session session, Throwable t) {
+        // ignored
+    }
 
     /**
      * A session has been closed
      *
      * @param session The closed {@link Session}
      */
-    void sessionClosed(Session session);
-
+    default void sessionClosed(Session session) {
+        // ignored
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
index 4b2af70..ad663e4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
@@ -1857,47 +1857,59 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen
      * @return The negotiated options {@link Map}
      */
     protected Map<KexProposalOption, String> negotiate() {
+        SessionListener listener = getSessionListenerProxy();
+        Map<KexProposalOption, String> c2sOptions = Collections.unmodifiableMap(clientProposal);
+        Map<KexProposalOption, String> s2cOptions = Collections.unmodifiableMap(serverProposal);
+        listener.sessionNegotiationStart(this, c2sOptions, s2cOptions);
+
         Map<KexProposalOption, String> guess = new EnumMap<>(KexProposalOption.class);
-        for (KexProposalOption paramType : KexProposalOption.VALUES) {
-            String clientParamValue = clientProposal.get(paramType);
-            String serverParamValue = serverProposal.get(paramType);
-            String[] c = GenericUtils.split(clientParamValue, ',');
-            String[] s = GenericUtils.split(serverParamValue, ',');
-            for (String ci : c) {
-                for (String si : s) {
-                    if (ci.equals(si)) {
-                        guess.put(paramType, ci);
+        Map<KexProposalOption, String> negotiatedGuess = Collections.unmodifiableMap(guess);
+        try {
+            for (KexProposalOption paramType : KexProposalOption.VALUES) {
+                String clientParamValue = c2sOptions.get(paramType);
+                String serverParamValue = s2cOptions.get(paramType);
+                String[] c = GenericUtils.split(clientParamValue, ',');
+                String[] s = GenericUtils.split(serverParamValue, ',');
+                for (String ci : c) {
+                    for (String si : s) {
+                        if (ci.equals(si)) {
+                            guess.put(paramType, ci);
+                            break;
+                        }
+                    }
+
+                    String value = guess.get(paramType);
+                    if (value != null) {
                         break;
                     }
                 }
 
+                // check if reached an agreement
                 String value = guess.get(paramType);
-                if (value != null) {
-                    break;
-                }
-            }
-
-            // check if reached an agreement
-            String value = guess.get(paramType);
-            if (value == null) {
-                String message = "Unable to negotiate key exchange for " + paramType.getDescription()
-                        + " (client: " + clientParamValue + " / server: " + serverParamValue + ")";
-                // OK if could not negotiate languages
-                if (KexProposalOption.S2CLANG.equals(paramType) || KexProposalOption.C2SLANG.equals(paramType)) {
-                    if (log.isTraceEnabled()) {
-                        log.trace("negotiate({}) {}", this, message);
+                if (value == null) {
+                    String message = "Unable to negotiate key exchange for " + paramType.getDescription()
+                            + " (client: " + clientParamValue + " / server: " + serverParamValue + ")";
+                    // OK if could not negotiate languages
+                    if (KexProposalOption.S2CLANG.equals(paramType) || KexProposalOption.C2SLANG.equals(paramType)) {
+                        if (log.isTraceEnabled()) {
+                            log.trace("negotiate({}) {}", this, message);
+                        }
+                    } else {
+                        throw new IllegalStateException(message);
                     }
                 } else {
-                    throw new IllegalStateException(message);
-                }
-            } else {
-                if (log.isTraceEnabled()) {
-                    log.trace("negotiate(" + this + ")[" + paramType.getDescription() + "] guess=" + value
-                            + " (client: " + clientParamValue + " / server: " + serverParamValue + ")");
+                    if (log.isTraceEnabled()) {
+                        log.trace("negotiate(" + this + ")[" + paramType.getDescription() + "] guess=" + value
+                                + " (client: " + clientParamValue + " / server: " + serverParamValue + ")");
+                    }
                 }
             }
+        } catch (RuntimeException | Error e) {
+            listener.sessionNegotiationEnd(this, c2sOptions, s2cOptions, negotiatedGuess, e);
+            throw e;
         }
 
+        listener.sessionNegotiationEnd(this, c2sOptions, s2cOptions, negotiatedGuess, null);
         return setNegotiationResult(guess);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpEventListener.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpEventListener.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpEventListener.java
index d026b4a..60a0d1f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpEventListener.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpEventListener.java
@@ -42,14 +42,18 @@ public interface SftpEventListener extends EventListener {
      * @param session The {@link ServerSession} through which the request was handled
      * @param version The negotiated SFTP version
      */
-    void initialized(ServerSession session, int version);
+    default void initialized(ServerSession session, int version) {
+        // ignored
+    }
 
     /**
      * Called when subsystem is destroyed since it was closed
      *
      * @param session The associated {@link ServerSession}
      */
-    void destroying(ServerSession session);
+    default void destroying(ServerSession session) {
+        // ignored
+    }
 
     /**
      * Specified file / directory has been opened
@@ -59,8 +63,10 @@ public interface SftpEventListener extends EventListener {
      * @param localHandle  The associated file / directory {@link Handle}
      * @throws IOException If failed to handle the call
      */
-    void open(ServerSession session, String remoteHandle, Handle localHandle)
-            throws IOException;
+    default void open(ServerSession session, String remoteHandle, Handle localHandle)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Result of reading entries from a directory - <B>Note:</B> it may be a
@@ -74,8 +80,10 @@ public interface SftpEventListener extends EventListener {
      *                     value = {@link Path} of the sub-entry
      * @throws IOException If failed to handle the call
      */
-    void read(ServerSession session, String remoteHandle, DirectoryHandle localHandle, Map<String, Path> entries)
-            throws IOException;
+    default void read(ServerSession session, String remoteHandle, DirectoryHandle localHandle, Map<String, Path> entries)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Preparing to read from a file
@@ -89,8 +97,10 @@ public interface SftpEventListener extends EventListener {
      * @param dataLen      Requested read length
      * @throws IOException If failed to handle the call
      */
-    void reading(ServerSession session, String remoteHandle, FileHandle localHandle,
-            long offset, byte[] data, int dataOffset, int dataLen) throws IOException;
+    default void reading(ServerSession session, String remoteHandle, FileHandle localHandle,
+            long offset, byte[] data, int dataOffset, int dataLen) throws IOException {
+        // ignored
+    }
 
     /**
      * Result of reading from a file
@@ -106,9 +116,11 @@ public interface SftpEventListener extends EventListener {
      * @param thrown       Non-{@code null} if read failed due to this exception
      * @throws IOException If failed to handle the call
      */
-    void read(ServerSession session, String remoteHandle, FileHandle localHandle,
+    default void read(ServerSession session, String remoteHandle, FileHandle localHandle,
               long offset, byte[] data, int dataOffset, int dataLen, int readLen, Throwable thrown)
-                      throws IOException;
+                      throws IOException {
+                          // ignored
+    }
 
     /**
      * Preparing to write to file
@@ -122,9 +134,11 @@ public interface SftpEventListener extends EventListener {
      * @param dataLen      Requested write length
      * @throws IOException If failed to handle the call
      */
-    void writing(ServerSession session, String remoteHandle, FileHandle localHandle,
+    default void writing(ServerSession session, String remoteHandle, FileHandle localHandle,
                long offset, byte[] data, int dataOffset, int dataLen)
-                       throws IOException;
+                       throws IOException {
+                           // ignored
+    }
 
     /**
      * Finished to writing to file
@@ -139,9 +153,11 @@ public interface SftpEventListener extends EventListener {
      * @param thrown       The reason for failing to write - {@code null} if successful
      * @throws IOException If failed to handle the call
      */
-    void written(ServerSession session, String remoteHandle, FileHandle localHandle,
+    default void written(ServerSession session, String remoteHandle, FileHandle localHandle,
                long offset, byte[] data, int dataOffset, int dataLen, Throwable thrown)
-                       throws IOException;
+                       throws IOException {
+                           // ignored
+    }
 
     /**
      * Called <U>prior</U> to blocking a file section
@@ -155,8 +171,10 @@ public interface SftpEventListener extends EventListener {
      * @throws IOException If failed to handle the call
      * @see #blocked(ServerSession, String, FileHandle, long, long, int, Throwable)
      */
-    void blocking(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, int mask)
-            throws IOException;
+    default void blocking(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, int mask)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>after</U> blocking a file section
@@ -170,8 +188,10 @@ public interface SftpEventListener extends EventListener {
      * @param thrown       If not-{@code null} then the reason for the failure to execute
      * @throws IOException If failed to handle the call
      */
-    void blocked(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, int mask, Throwable thrown)
-            throws IOException;
+    default void blocked(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, int mask, Throwable thrown)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>prior</U> to un-blocking a file section
@@ -183,8 +203,10 @@ public interface SftpEventListener extends EventListener {
      * @param length       Section size for un-locking
      * @throws IOException If failed to handle the call
      */
-    void unblocking(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length)
-            throws IOException;
+    default void unblocking(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>prior</U> to un-blocking a file section
@@ -197,8 +219,10 @@ public interface SftpEventListener extends EventListener {
      * @param thrown       If not-{@code null} then the reason for the failure to execute
      * @throws IOException If failed to handle the call
      */
-    void unblocked(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, Throwable thrown)
-            throws IOException;
+    default void unblocked(ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, Throwable thrown)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Specified file / directory has been closed
@@ -207,7 +231,9 @@ public interface SftpEventListener extends EventListener {
      * @param remoteHandle The (opaque) assigned handle for the file / directory
      * @param localHandle  The associated file / directory {@link Handle}
      */
-    void close(ServerSession session, String remoteHandle, Handle localHandle);
+    default void close(ServerSession session, String remoteHandle, Handle localHandle) {
+        // ignored
+    }
 
     /**
      * Called <U>prior</U> to creating a directory
@@ -218,8 +244,10 @@ public interface SftpEventListener extends EventListener {
      * @throws IOException If failed to handle the call
      * @see #created(ServerSession, Path, Map, Throwable)
      */
-    void creating(ServerSession session, Path path, Map<String, ?> attrs)
-            throws IOException;
+    default void creating(ServerSession session, Path path, Map<String, ?> attrs)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>after</U> creating a directory
@@ -230,8 +258,10 @@ public interface SftpEventListener extends EventListener {
      * @param thrown  If not-{@code null} then the reason for the failure to execute
      * @throws IOException If failed to handle the call
      */
-    void created(ServerSession session, Path path, Map<String, ?> attrs, Throwable thrown)
-            throws IOException;
+    default void created(ServerSession session, Path path, Map<String, ?> attrs, Throwable thrown)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>prior</U> to renaming a file / directory
@@ -243,8 +273,10 @@ public interface SftpEventListener extends EventListener {
      * @throws IOException If failed to handle the call
      * @see #moved(ServerSession, Path, Path, Collection, Throwable)
      */
-    void moving(ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts)
-            throws IOException;
+    default void moving(ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>after</U> renaming a file / directory
@@ -256,8 +288,10 @@ public interface SftpEventListener extends EventListener {
      * @param thrown  If not-{@code null} then the reason for the failure to execute
      * @throws IOException If failed to handle the call
      */
-    void moved(ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts, Throwable thrown)
-            throws IOException;
+    default void moved(ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts, Throwable thrown)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>prior</U> to removing a file / directory
@@ -267,7 +301,9 @@ public interface SftpEventListener extends EventListener {
      * @throws IOException If failed to handle the call
      * @see #removed(ServerSession, Path, Throwable)
      */
-    void removing(ServerSession session, Path path) throws IOException;
+    default void removing(ServerSession session, Path path) throws IOException {
+        // ignored
+    }
 
     /**
      * Called <U>after</U> a file / directory has been removed
@@ -277,7 +313,9 @@ public interface SftpEventListener extends EventListener {
      * @param thrown  If not-{@code null} then the reason for the failure to execute
      * @throws IOException If failed to handle the call
      */
-    void removed(ServerSession session, Path path, Throwable thrown) throws IOException;
+    default void removed(ServerSession session, Path path, Throwable thrown) throws IOException {
+        // ignored
+    }
 
     /**
      * Called <U>prior</U> to creating a link
@@ -289,8 +327,10 @@ public interface SftpEventListener extends EventListener {
      * @throws IOException If failed to handle the call
      * @see #linked(ServerSession, Path, Path, boolean, Throwable)
      */
-    void linking(ServerSession session, Path source, Path target, boolean symLink)
-            throws IOException;
+    default void linking(ServerSession session, Path source, Path target, boolean symLink)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>after</U> creating a link
@@ -302,8 +342,10 @@ public interface SftpEventListener extends EventListener {
      * @param thrown  If not-{@code null} then the reason for the failure to execute
      * @throws IOException If failed to handle the call
      */
-    void linked(ServerSession session, Path source, Path target, boolean symLink, Throwable thrown)
-            throws IOException;
+    default void linked(ServerSession session, Path source, Path target, boolean symLink, Throwable thrown)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>prior</U> to modifying the attributes of a file / directory
@@ -315,8 +357,10 @@ public interface SftpEventListener extends EventListener {
      * @throws IOException If failed to handle the call
      * @see #modifiedAttributes(ServerSession, Path, Map, Throwable)
      */
-    void modifyingAttributes(ServerSession session, Path path, Map<String, ?> attrs)
-            throws IOException;
+    default void modifyingAttributes(ServerSession session, Path path, Map<String, ?> attrs)
+            throws IOException {
+                // ignored
+    }
 
     /**
      * Called <U>after</U> modifying the attributes of a file / directory
@@ -328,6 +372,8 @@ public interface SftpEventListener extends EventListener {
      * @param thrown  If not-{@code null} then the reason for the failure to execute
      * @throws IOException If failed to handle the call
      */
-    void modifiedAttributes(ServerSession session, Path path, Map<String, ?> attrs, Throwable thrown)
-            throws IOException;
+    default void modifiedAttributes(ServerSession session, Path path, Map<String, ?> attrs, Throwable thrown)
+            throws IOException {
+                // ignored
+    }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java b/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
index c86883a..4cffe5e 100644
--- a/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
@@ -392,27 +392,12 @@ public class KeyReExchangeTest extends BaseTestSupport {
                     final AtomicInteger exchanges = new AtomicInteger();
                     session.addSessionListener(new SessionListener() {
                         @Override
-                        public void sessionCreated(Session session) {
-                            // ignored
-                        }
-
-                        @Override
                         public void sessionEvent(Session session, Event event) {
                             if (Event.KeyEstablished.equals(event)) {
                                 int count = exchanges.incrementAndGet();
                                 outputDebugMessage("Key established for %s - count=%d", session, count);
                             }
                         }
-
-                        @Override
-                        public void sessionException(Session session, Throwable t) {
-                            // ignored
-                        }
-
-                        @Override
-                        public void sessionClosed(Session session) {
-                            // ignored
-                        }
                     });
 
                     byte[] data = sb.toString().getBytes(StandardCharsets.UTF_8);
@@ -509,27 +494,12 @@ public class KeyReExchangeTest extends BaseTestSupport {
                     final AtomicInteger exchanges = new AtomicInteger();
                     session.addSessionListener(new SessionListener() {
                         @Override
-                        public void sessionCreated(Session session) {
-                            // ignored
-                        }
-
-                        @Override
                         public void sessionEvent(Session session, Event event) {
                             if (Event.KeyEstablished.equals(event)) {
                                 int count = exchanges.incrementAndGet();
                                 outputDebugMessage("Key established for %s - count=%d", session, count);
                             }
                         }
-
-                        @Override
-                        public void sessionException(Session session, Throwable t) {
-                            // ignored
-                        }
-
-                        @Override
-                        public void sessionClosed(Session session) {
-                            // ignored
-                        }
                     });
 
                     byte[] data = getCurrentTestName().getBytes(StandardCharsets.UTF_8);
@@ -654,27 +624,12 @@ public class KeyReExchangeTest extends BaseTestSupport {
                     final AtomicInteger exchanges = new AtomicInteger();
                     session.addSessionListener(new SessionListener() {
                         @Override
-                        public void sessionCreated(Session session) {
-                            // ignored
-                        }
-
-                        @Override
                         public void sessionEvent(Session session, Event event) {
                             if (Event.KeyEstablished.equals(event)) {
                                 int count = exchanges.incrementAndGet();
                                 outputDebugMessage("Key established for %s - count=%d", session, count);
                             }
                         }
-
-                        @Override
-                        public void sessionException(Session session, Throwable t) {
-                            // ignored
-                        }
-
-                        @Override
-                        public void sessionClosed(Session session) {
-                            // ignored
-                        }
                     });
 
                     byte[] data = (getClass().getName() + "#" + getCurrentTestName() + "\n").getBytes(StandardCharsets.UTF_8);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java b/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
index f42704a..a7e18fe 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientAuthenticationManagerTest.java
@@ -38,7 +38,6 @@ import org.apache.sshd.client.session.ClientSessionImpl;
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.NamedResource;
-import org.apache.sshd.common.channel.Channel;
 import org.apache.sshd.common.channel.ChannelListener;
 import org.apache.sshd.common.forward.DefaultTcpipForwarderFactory;
 import org.apache.sshd.common.forward.PortForwardingEventListener;
@@ -51,7 +50,6 @@ import org.apache.sshd.common.random.SingletonRandomFactory;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.session.SessionListener;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.net.SshdSocketAddress;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -260,78 +258,8 @@ public class ClientAuthenticationManagerTest extends BaseTestSupport {
                 // ignored
             }
         });
-        Mockito.when(client.getChannelListenerProxy()).thenReturn(new ChannelListener() {
-            @Override
-            public void channelOpenSuccess(Channel channel) {
-                // ignored
-            }
-
-            @Override
-            public void channelOpenFailure(Channel channel, Throwable reason) {
-                // ignored
-            }
-
-            @Override
-            public void channelInitialized(Channel channel) {
-                // ignored
-            }
-
-            @Override
-            public void channelStateChanged(Channel channel, String hint) {
-                // ignored
-            }
-
-            @Override
-            public void channelClosed(Channel channel, Throwable reason) {
-                // ignored
-            }
-        });
-        Mockito.when(client.getPortForwardingEventListenerProxy()).thenReturn(new PortForwardingEventListener() {
-            @Override
-            public void tornDownExplicitTunnel(Session session, SshdSocketAddress address, boolean localForwarding,
-                    Throwable reason) throws IOException {
-                // ignored
-            }
-
-            @Override
-            public void tornDownDynamicTunnel(Session session, SshdSocketAddress address, Throwable reason) throws IOException {
-                // ignored
-            }
-
-            @Override
-            public void tearingDownExplicitTunnel(Session session, SshdSocketAddress address, boolean localForwarding)
-                    throws IOException {
-                // ignored
-            }
-
-            @Override
-            public void tearingDownDynamicTunnel(Session session, SshdSocketAddress address) throws IOException {
-                // ignored
-            }
-
-            @Override
-            public void establishingExplicitTunnel(Session session, SshdSocketAddress local, SshdSocketAddress remote,
-                    boolean localForwarding) throws IOException {
-                // ignored
-            }
-
-            @Override
-            public void establishingDynamicTunnel(Session session, SshdSocketAddress local) throws IOException {
-                // ignored
-            }
-
-            @Override
-            public void establishedExplicitTunnel(Session session, SshdSocketAddress local, SshdSocketAddress remote,
-                    boolean localForwarding, SshdSocketAddress boundAddress, Throwable reason) throws IOException {
-                // ignored
-            }
-
-            @Override
-            public void establishedDynamicTunnel(Session session, SshdSocketAddress local, SshdSocketAddress boundAddress,
-                    Throwable reason) throws IOException {
-                // ignored
-            }
-        });
+        Mockito.when(client.getChannelListenerProxy()).thenReturn(ChannelListener.EMPTY);
+        Mockito.when(client.getPortForwardingEventListenerProxy()).thenReturn(PortForwardingEventListener.EMPTY);
         Factory<Random> randomFactory = new SingletonRandomFactory(JceRandomFactory.INSTANCE);
         Mockito.when(client.getRandomFactory()).thenReturn(randomFactory);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java b/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java
index 6df2a69..a1cd3dc 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientSessionListenerTest.java
@@ -95,21 +95,6 @@ public class ClientSessionListenerTest extends BaseTestSupport {
                 session.setCipherFactories(Collections.singletonList((NamedFactory<Cipher>) kexParams.get(KexProposalOption.C2SENC)));
                 session.setMacFactories(Collections.singletonList((NamedFactory<Mac>) kexParams.get(KexProposalOption.C2SMAC)));
             }
-
-            @Override
-            public void sessionEvent(Session session, Event event) {
-                // ignored
-            }
-
-            @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
-            @Override
-            public void sessionClosed(Session session) {
-                // ignored
-            }
         });
 
         client.start();
@@ -138,11 +123,6 @@ public class ClientSessionListenerTest extends BaseTestSupport {
 
         client.addSessionListener(new SessionListener() {
             @Override
-            public void sessionCreated(Session session) {
-                // ignored
-            }
-
-            @Override
             public void sessionEvent(Session session, Event event) {
                 if ((!session.isAuthenticated()) && (session instanceof ClientSession) && Event.KexCompleted.equals(event)) {
                     ClientSession clientSession = (ClientSession) session;
@@ -150,16 +130,6 @@ public class ClientSessionListenerTest extends BaseTestSupport {
                     clientSession.setUserInteraction(UserInteraction.NONE);
                 }
             }
-
-            @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
-            @Override
-            public void sessionClosed(Session session) {
-                // ignored
-            }
         });
 
         client.start();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
index 7ac8825..97142f1 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
@@ -259,11 +259,6 @@ public class ClientTest extends BaseTestSupport {
                 updateSessionConfigProperty(session, "sessionClosed");
             }
 
-            @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
             private void updateSessionConfigProperty(Session session, Object value) {
                 PropertyResolverUtils.updateProperty(session, sessionPropName, value);
                 sessionConfigValueHolder.set(value);
@@ -293,11 +288,6 @@ public class ClientTest extends BaseTestSupport {
                 updateChannelConfigProperty(channel, "channelClosed");
             }
 
-            @Override
-            public void channelStateChanged(Channel channel, String hint) {
-                // ignored
-            }
-
             private void updateChannelConfigProperty(Channel channel, Object value) {
                 PropertyResolverUtils.updateProperty(channel, channelPropName, value);
                 channelConfigValueHolder.set(value);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
index bafd8aa..929e377 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
@@ -89,11 +89,6 @@ public class SimpleSessionClientTest extends BaseSimpleClientTestSupport {
     public void testConnectionTimeout() throws Exception {
         client.addSessionListener(new SessionListener() {
             @Override
-            public void sessionEvent(Session session, Event event) {
-                // ignored
-            }
-
-            @Override
             public void sessionCreated(Session session) {
                 try {
                     Thread.sleep(CONNECT_TIMEOUT + 150L);
@@ -101,16 +96,6 @@ public class SimpleSessionClientTest extends BaseSimpleClientTestSupport {
                     // ignored
                 }
             }
-
-            @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
-            @Override
-            public void sessionClosed(Session session) {
-                // ignored
-            }
         });
         client.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
index 3fea9c2..8e29598 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
@@ -202,16 +202,6 @@ public class AuthenticationTest extends BaseTestSupport {
                 }
 
                 @Override
-                public void serverVersionInfo(ClientSession session, List<String> lines) {
-                    // ignored
-                }
-
-                @Override
-                public void welcome(ClientSession session, String banner, String lang) {
-                    // ignored
-                }
-
-                @Override
                 public String[] interactive(ClientSession session, String name, String instruction, String lang, String[] prompt, boolean[] echo) {
                     throw new UnsupportedOperationException("Unexpected call");
                 }
@@ -443,16 +433,6 @@ public class AuthenticationTest extends BaseTestSupport {
                 }
 
                 @Override
-                public void serverVersionInfo(ClientSession session, List<String> lines) {
-                    // ignored
-                }
-
-                @Override
-                public void welcome(ClientSession session, String banner, String lang) {
-                    // ignored
-                }
-
-                @Override
                 public String[] interactive(ClientSession session, String name, String instruction, String lang, String[] prompt, boolean[] echo) {
                     assertEquals("Unexpected multiple calls", 1, interactiveCount.incrementAndGet());
                     assertEquals("Mismatched name", challenge.getInteractionName(), name);
@@ -520,16 +500,6 @@ public class AuthenticationTest extends BaseTestSupport {
                 }
 
                 @Override
-                public void serverVersionInfo(ClientSession session, List<String> lines) {
-                    // ignored
-                }
-
-                @Override
-                public void welcome(ClientSession session, String banner, String lang) {
-                    // ignored
-                }
-
-                @Override
                 public String[] interactive(ClientSession session, String name, String instruction, String lang, String[] prompt, boolean[] echo) {
                     throw new UnsupportedOperationException("Unexpected call");
                 }
@@ -564,25 +534,10 @@ public class AuthenticationTest extends BaseTestSupport {
             final AtomicInteger invocations = new AtomicInteger(0);
             client.addSessionListener(new SessionListener() {
                 @Override
-                public void sessionCreated(Session session) {
-                    // ignored
-                }
-
-                @Override
                 public void sessionEvent(Session session, Event event) {
                     assertEquals("Mismatched invocations count", 1, invocations.incrementAndGet());
                     throw expected;
                 }
-
-                @Override
-                public void sessionException(Session session, Throwable t) {
-                    // ignored
-                }
-
-                @Override
-                public void sessionClosed(Session session) {
-                    // ignored
-                }
             });
 
             client.start();
@@ -855,16 +810,6 @@ public class AuthenticationTest extends BaseTestSupport {
         final String[] response = {pswd};
         s.setUserInteraction(new UserInteraction() {
             @Override
-            public void welcome(ClientSession session, String banner, String lang) {
-                // ignored
-            }
-
-            @Override
-            public void serverVersionInfo(ClientSession session, List<String> lines) {
-                // ignored
-            }
-
-            @Override
             public boolean isInteractionAllowed(ClientSession session) {
                 return true;
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java b/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
index 2319c31..4ded562 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
@@ -83,11 +83,6 @@ public class CompressionTest extends BaseTestSupport {
         sshd.setCompressionFactories(Arrays.<NamedFactory<org.apache.sshd.common.compression.Compression>>asList(factory));
         sshd.addSessionListener(new SessionListener() {
             @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
-            @Override
             @SuppressWarnings("synthetic-access")
             public void sessionEvent(Session session, Event event) {
                 if (Event.KeyEstablished.equals(event)) {
@@ -98,16 +93,6 @@ public class CompressionTest extends BaseTestSupport {
                     }
                 }
             }
-
-            @Override
-            public void sessionCreated(Session session) {
-                // ignored
-            }
-
-            @Override
-            public void sessionClosed(Session session) {
-                // ignored
-            }
         });
         sshd.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java b/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java
index 22f8cb3..6ece5e7 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/session/ReservedSessionMessagesHandlerTest.java
@@ -97,11 +97,6 @@ public class ReservedSessionMessagesHandlerTest extends BaseTestSupport {
             final Semaphore signal = new Semaphore(0);
             sshd.addSessionListener(new SessionListener() {
                 @Override
-                public void sessionException(Session session, Throwable t) {
-                    // ignored
-                }
-
-                @Override
                 public void sessionEvent(final Session session, Event event) {
                     if (Event.Authenticated.equals(event)) {
                         service.execute(new Runnable() {
@@ -120,16 +115,6 @@ public class ReservedSessionMessagesHandlerTest extends BaseTestSupport {
                         });
                     }
                 }
-
-                @Override
-                public void sessionCreated(Session session) {
-                    // ignored
-                }
-
-                @Override
-                public void sessionClosed(Session session) {
-                    // ignored
-                }
             });
 
             client.start();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java
index 4effede..8b37999 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerProxyAcceptorTest.java
@@ -109,11 +109,6 @@ public class ServerProxyAcceptorTest extends BaseTestSupport {
         final Semaphore sessionSignal = new Semaphore(0);
         sshd.addSessionListener(new SessionListener() {
             @Override
-            public void sessionException(Session session, Throwable t) {
-               // do nothing
-            }
-
-            @Override
             public void sessionEvent(Session session, Event event) {
                 verifyClientAddress(event.name(), session);
                 if (Event.KeyEstablished.equals(event)) {
@@ -122,11 +117,6 @@ public class ServerProxyAcceptorTest extends BaseTestSupport {
             }
 
             @Override
-            public void sessionCreated(Session session) {
-                // do nothing - no proxy yet
-            }
-
-            @Override
             public void sessionClosed(Session session) {
                 verifyClientAddress("sessionClosed", session);
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
index 8357be5..4b13e8a 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
@@ -88,7 +88,7 @@ public class ServerSessionListenerTest extends BaseTestSupport {
 
     @Test   // see https://issues.apache.org/jira/browse/SSHD-456
     public void testServerStillListensIfSessionListenerThrowsException() throws Exception {
-        final Map<String, SocketAddress> eventsMap = new TreeMap<String, SocketAddress>(String.CASE_INSENSITIVE_ORDER);
+        final Map<String, SocketAddress> eventsMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         final Logger log = LoggerFactory.getLogger(getClass());
         sshd.addSessionListener(new SessionListener() {
             @Override
@@ -106,11 +106,6 @@ public class ServerSessionListenerTest extends BaseTestSupport {
                 throwException("SessionClosed", session);
             }
 
-            @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
             private void throwException(String phase, Session session) {
                 IoSession ioSession = session.getIoSession();
                 SocketAddress addr = ioSession.getRemoteAddress();
@@ -172,21 +167,6 @@ public class ServerSessionListenerTest extends BaseTestSupport {
                 session.setCipherFactories(Collections.singletonList((NamedFactory<Cipher>) kexParams.get(KexProposalOption.S2CENC)));
                 session.setMacFactories(Collections.singletonList((NamedFactory<Mac>) kexParams.get(KexProposalOption.S2CMAC)));
             }
-
-            @Override
-            public void sessionEvent(Session session, Event event) {
-                // ignored
-            }
-
-            @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
-            @Override
-            public void sessionClosed(Session session) {
-                // ignored
-            }
         });
 
         client.start();
@@ -224,21 +204,6 @@ public class ServerSessionListenerTest extends BaseTestSupport {
                                     ServerAuthenticationManager.Utils.DEFAULT_USER_AUTH_PASSWORD_FACTORY));
                 }
             }
-
-            @Override
-            public void sessionEvent(Session session, Event event) {
-                // ignored
-            }
-
-            @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
-            @Override
-            public void sessionClosed(Session session) {
-                // ignored
-            }
         });
 
         client.start();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/997ae449/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
index 1d5fd4f..957c0a6 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
@@ -486,52 +486,22 @@ public class ServerTest extends BaseTestSupport {
         final AtomicInteger serverEventCount = new AtomicInteger(0);
         sshd.addSessionListener(new SessionListener() {
             @Override
-            public void sessionCreated(Session session) {
-                // ignored
-            }
-
-            @Override
             public void sessionEvent(Session session, Event event) {
                 if (event == Event.KexCompleted) {
                     serverEventCount.incrementAndGet();
                 }
             }
-
-            @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
-            @Override
-            public void sessionClosed(Session session) {
-                // ignored
-            }
         });
         sshd.start();
 
         final AtomicInteger clientEventCount = new AtomicInteger(0);
         client.addSessionListener(new SessionListener() {
             @Override
-            public void sessionCreated(Session session) {
-                // ignored
-            }
-
-            @Override
             public void sessionEvent(Session session, Event event) {
                 if (event == Event.KexCompleted) {
                     clientEventCount.incrementAndGet();
                 }
             }
-
-            @Override
-            public void sessionException(Session session, Throwable t) {
-                // ignored
-            }
-
-            @Override
-            public void sessionClosed(Session session) {
-                // ignored
-            }
         });
         client.start();
 
@@ -601,26 +571,6 @@ public class ServerTest extends BaseTestSupport {
                     outputDebugMessage("channelStateChanged(%s): %s", channel, hint);
                     stateChangeHints.add(hint);
                 }
-
-                @Override
-                public void channelOpenSuccess(Channel channel) {
-                    // ignored
-                }
-
-                @Override
-                public void channelOpenFailure(Channel channel, Throwable reason) {
-                    // ignored
-                }
-
-                @Override
-                public void channelInitialized(Channel channel) {
-                    // ignored
-                }
-
-                @Override
-                public void channelClosed(Channel channel, Throwable reason) {
-                    // ignored
-                }
             });
             shell.open().verify(9L, TimeUnit.SECONDS);
 
@@ -642,7 +592,7 @@ public class ServerTest extends BaseTestSupport {
 
     @Test
     public void testEnvironmentVariablesPropagationToServer() throws Exception {
-        final AtomicReference<Environment> envHolder = new AtomicReference<Environment>(null);
+        final AtomicReference<Environment> envHolder = new AtomicReference<>(null);
         sshd.setCommandFactory(new CommandFactory() {
             @Override
             public Command createCommand(final String command) {
@@ -814,16 +764,6 @@ public class ServerTest extends BaseTestSupport {
         final String[] replies = {getCurrentTestName()};
         client.setUserInteraction(new UserInteraction() {
             @Override
-            public void welcome(ClientSession session, String banner, String lang) {
-                // ignored
-            }
-
-            @Override
-            public void serverVersionInfo(ClientSession clientSession, List<String> lines) {
-                // ignored
-            }
-
-            @Override
             public boolean isInteractionAllowed(ClientSession session) {
                 return true;
             }
@@ -917,11 +857,6 @@ public class ServerTest extends BaseTestSupport {
         final Semaphore signal = new Semaphore(0);
         client.setUserInteraction(new UserInteraction() {
             @Override
-            public void welcome(ClientSession session, String banner, String lang) {
-                // ignored
-            }
-
-            @Override
             public void serverVersionInfo(ClientSession session, List<String> lines) {
                 assertNull("Unexpected extra call", actualHolder.getAndSet(lines));
                 signal.release();