2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.nettyutil.handler.ssh.client;
11 import ch.ethz.ssh2.Session;
12 import ch.ethz.ssh2.StreamGobbler;
14 import ch.ethz.ssh2.channel.Channel;
15 import java.io.Closeable;
16 import java.io.IOException;
17 import java.io.InputStream;
18 import java.io.OutputStream;
21 * Wrapper class for proprietary SSH sessions implementations
23 class SshSession implements Closeable {
24 private final Session session;
26 public SshSession(Session session) {
27 this.session = session;
31 public void startSubSystem(String name) throws IOException {
32 session.startSubSystem(name);
35 public InputStream getStdout() {
36 return new StreamGobbler(session.getStdout());
39 public InputStream getStderr() {
40 return session.getStderr();
43 public OutputStream getStdin() {
44 return session.getStdin();
49 if (session.getState() == Channel.STATE_OPEN || session.getState() == Channel.STATE_OPENING) {