try
{
// The connection is authenticated we can now do some real work!
SessionChannelClient session = ssh.openSessionChannel();
if ( session.executeCommand(cmd)){
IOStreamConnector output = new IOStreamConnector();
java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
output.connect(session.getInputStream(), bos );
session.getState().waitForState(ChannelState.CHANNEL_CLOSED);
theOutput = bos.toString();