}
if (conn == null ){
s_logger.error("Connection is null");
}
Session sess = conn.openSession();
s_logger.info("User + " + _account.get() + " executing : wget http://192.168.1.250/dump.bin");
sess
.execCommand("wget http://192.168.1.250/dump.bin && dir dump.bin");
InputStream stdout = sess.getStdout();
InputStream stderr = sess.getStderr();
byte[] buffer = new byte[8192];
while (true) {
if ((stdout.available() == 0) && (stderr.available() == 0)) {
int conditions = sess.waitForCondition(
ChannelCondition.STDOUT_DATA
| ChannelCondition.STDERR_DATA
| ChannelCondition.EOF, 120000);
if ((conditions & ChannelCondition.TIMEOUT) != 0) {
s_logger
.info("Timeout while waiting for data from peer.");
return null;
}
if ((conditions & ChannelCondition.EOF) != 0) {
if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
break;
}
}
}
while (stdout.available() > 0) {
success = true;
int len = stdout.read(buffer);
if (len > 0) // this check is somewhat paranoid
s_logger.info(new String(buffer, 0, len));
}
while (stderr.available() > 0) {
/* int len = */stderr.read(buffer);
}
}
sess.close();
conn.close();
if (success) {
Thread.sleep(120000);
return null;