public boolean setSessionAndStreams() {

        outputBuffer = new StringBuilder();

        try
        {
            Channel channel = sesConnection.openChannel("shell");

            in = new DataInputStream(channel.getInputStream());
            out = new DataOutputStream(channel.getOutputStream());

            channel.connect();

            byte[] tmp = new byte[1024];
            boolean rdy = false;
            while(true){
                while(in.available()>0){
                    rdy = true;
                    int i=in.read(tmp, 0, 1024);
                    if(i<0)break;
                    outputBuffer.append(new String(tmp, 0, i));
                }
                try{Thread.sleep(1000);}catch(Exception ee){}
                if (rdy & in.available()<=0) {
                    break;
                }
            }

        }
        catch(IOException ioX)
        {
            logWarning(ioX.getMessage());
            return false;
        }
        catch(JSchException jschX)
        {
            logWarning(jschX.getMessage());
            return false;
        }

        return true;
    }