Hi everyone

I am using ChannelDirectTCPIP to forward arbitrary data to machines behind my SSH server. Unfortunately the connect method does not provide the possibility to define a timeout value. In my case my Linux SSH server box has a tcp timeout of about 190 seconds. ChannelDirectTCPIP.connect() calls Channel.sendChannelOpen(), which will retry opening the channel 10 times with 5 second wait time and then throws an Exception.

So far so good. But when the ssh server sends the server side channel connection failure message back to the session, the JSch session will terminate with the following message in the log. I assume, that the channel object is no longer available anymore, which causes the NullPointerException.

INFO: Caught an exception, leaving main loop due to null
DEBUG: session: run() exception: class java.lang.NullPointerException
INFO: Disconnecting from port 22

Is it possible to add timeouts to ChannelDirectTCPIP?