SSH OutputStream

0

Cześć! Piszę prostą aplikację w której wykorzystuję SSH i JavaFx.
Mam mały problem :)
Kod:

 try{
            JSch jsch=new JSch();


            String config =
                    "Port 22\n"+
                            "\n"+
                            "Host foo\n"+
                            "  User "+user+"\n"+
                            "  Hostname "+host+"\n"+
                            "Host *\n"+
                            "  ConnectTime 30000\n"+
                            "  PreferredAuthentications keyboard-interactive,password,publickey\n"+
                            "  #ForwardAgent yes\n"+
                            "  #StrictHostKeyChecking no\n"+
                            "  #IdentityFile ~/.ssh/id_rsa\n"+
                            "  #UserKnownHostsFile ~/.ssh/known_hosts";

            //textArea.setText("Generated configurations:");
           // textArea.setText(config);

            ConfigRepository configRepository =
                    com.jcraft.jsch.OpenSSHConfig.parse(config);
            //com.jcraft.jsch.OpenSSHConfig.parseFile("~/.ssh/config");

            jsch.setConfigRepository(configRepository);

            // "foo" is from "Host foo" in the above config.
            Session session=jsch.getSession("foo");

            session.setPassword(pass);


            UserInfo ui = new MyUserInfo(){
                public void showMessage(String message){
                    //textArea.setText(message);
                }
                public boolean promptYesNo(String message){
                    Object[] options={ "yes", "no" };
                    int foo = 0;
                    return foo==0;
                }

            };


            session.setUserInfo(ui);

            session.connect(); // making a connection with timeout as defined above.

            Channel channel=session.openChannel("shell");


            final ByteArrayOutputStream baos = new ByteArrayOutputStream();


            channel.setInputStream(System.in);
            channel.setOutputStream(System.out);
            

            channel.connect(3*1000);
        }
        catch(Exception e){
            out.println(e);
        }
    }

Wszystkie informacje są wysyłane do System.out, a chciałbym żeby informacje wyświetlane były w TextArea.
Może ktoś ma pomysł jak to zrobić?

1 użytkowników online, w tym zalogowanych: 0, gości: 1