// The connection is authenticated we can now do some real work!
SessionChannelClient session = ssh.openSessionChannel();
if(!session.requestPseudoTerminal("vt100", 80, 24, 0, 0, ""))
System.out.println("Failed to allocate a pseudo terminal");
if (session.startShell()) {
IOStreamConnector input =
new IOStreamConnector();
IOStreamConnector output =
new IOStreamConnector();
IOStreamConnector error =
new IOStreamConnector();
output.setCloseOutput(false);
input.setCloseInput(false);
error.setCloseOutput(false);
input.connect(System.in, session.getOutputStream());
output.connect(session.getInputStream(), System.out);
error.connect(session.getStderrInputStream(), System.out);
session.getState().waitForState(ChannelState.CHANNEL_CLOSED);
}else
System.out.println("Failed to start the users shell");
ssh.disconnect();
}