}
}
// TODO: implement sending a direct command
SshClient client = null;
try {
client = SshClient.setUpDefaultClient();
client.start();
ClientSession session = client.connect(host, port);
session.authPassword(user, password);
ClientChannel channel = session.createChannel("shell");
channel.setIn(new ConsoleReader().getInput());
channel.setOut(System.out);
channel.setErr(System.err);
channel.open();
channel.waitFor(ClientChannel.CLOSED, 0);
} catch (Throwable t) {
t.printStackTrace();
System.exit(1);
} finally {
try {
client.stop();
} catch (Throwable t) { }
}
System.exit(0);
}