* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.netconf.ssh;
import com.google.common.base.Preconditions;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.local.LocalAddress;
import io.netty.channel.local.LocalChannel;
-import io.netty.util.concurrent.GenericFutureListener;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.io.IoInputStream;
import org.apache.sshd.common.io.IoOutputStream;
-import org.apache.sshd.server.AsyncCommand;
-import org.apache.sshd.server.Command;
import org.apache.sshd.server.Environment;
import org.apache.sshd.server.ExitCallback;
import org.apache.sshd.server.SessionAware;
+import org.apache.sshd.server.command.AsyncCommand;
+import org.apache.sshd.server.command.Command;
import org.apache.sshd.server.session.ServerSession;
import org.opendaylight.netconf.api.messages.NetconfHelloMessageAdditionalHeader;
import org.slf4j.Logger;
}
});
clientChannelFuture = clientBootstrap.connect(localAddress);
- clientChannelFuture.addListener(new GenericFutureListener<ChannelFuture>() {
-
- @Override
- public void operationComplete(final ChannelFuture future) {
- if (future.isSuccess()) {
- clientChannel = clientChannelFuture.channel();
- } else {
- LOG.warn("Unable to establish internal connection to netconf server for client: {}",
- getClientAddress());
- Preconditions.checkNotNull(callback, "Exit callback must be set");
- callback.onExit(1, "Unable to establish internal connection to netconf server for client: "
- + getClientAddress());
- }
+ clientChannelFuture.addListener(future -> {
+ if (future.isSuccess()) {
+ clientChannel = clientChannelFuture.channel();
+ } else {
+ LOG.warn("Unable to establish internal connection to netconf server for client: {}",
+ getClientAddress());
+ Preconditions.checkNotNull(callback, "Exit callback must be set");
+ callback.onExit(1, "Unable to establish internal connection to netconf server for client: "
+ + getClientAddress());
}
});
}
clientChannelFuture.cancel(true);
if (clientChannel != null) {
- clientChannel.close().addListener(new GenericFutureListener<ChannelFuture>() {
-
- @Override
- public void operationComplete(final ChannelFuture future) {
- if (!future.isSuccess()) {
- LOG.warn("Unable to release internal connection to netconf server on channel: {}",
- clientChannel);
- }
+ clientChannel.close().addListener(future -> {
+ if (!future.isSuccess()) {
+ LOG.warn("Unable to release internal connection to netconf server on channel: {}",
+ clientChannel);
}
});
}