Hi, guys, I developed a proxy application, by which users can telnet to it and send a "connect to xxx" command to connect to a ssh server. I use JSch as my ssh client:
JSch jsch = new JSch();
Session session = jsch.getSession(username, ip, 22);
Channel channel = session.openChannel("shell");
InputStream serverInputStream = channel.getInputStream();
OutputStream serverOutputStream = channel.getOutputStream();
MyReader myReader = new MyReader(userOutputStream, serverInputStream);
MyWriterThread myWriter = new MyWriter(userInputStream, serverOutputStream);
then deal with input and output respectively in these two new threads. But the server performance dropped rapidly with the increase of user amount for too many concurrent threads. So I want to use java.nio.channels.Selector and SocketChannel to decrease thread amount. However I can't find a way to connect input/output stream with Selector and SocketChannel. Does the ssh client of JSch support Java NIO?
Thanks a lot!