import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicBoolean;
import org.opendaylight.controller.netconf.nettyutil.handler.ssh.virtualsocket.VirtualSocketException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* pipeline.
*/
public class SshClientAdapter implements Runnable {
+ private static final Logger logger = LoggerFactory.getLogger(SshClientAdapter.class);
+
private static final int BUFFER_SIZE = 1024;
private final SshClient sshClient;
}
public void run() {
+ SshSession session;
+ try {
+ session = sshClient.openSession();
+ } catch (IOException e) {
+ logger.error("Cannot establish session", e);
+ sshClient.close();
+ return;
+ }
try {
- SshSession session = sshClient.openSession();
invoker.invoke(session);
InputStream stdOut = session.getStdout();
session.getStderr();
// Netty closed connection prematurely.
// Just pass and move on.
} catch (Exception e) {
- throw new IllegalStateException(e);
+ logger.error("Unexpected exception", e);
} finally {
sshClient.close();