public boolean connect() throws JSchException {
try {
session = ssh.getSession(this.usuario, this.host, this.porta);
session.setPassword(this.senha);
session.setConfig("StrictHostKeyChecking", "no");
session.connect(30000);
setSession(session);
setReady(true);
return true;
} catch (Exception e) {
setReady(false);
}
return false;
}
public void close() {
if (channel != null)
channel.disconnect();
if (session != null)
session.disconnect();
setReady(false);
}