JSchException with "timeout in wating for rekeying process." message is received after prompt dialog "The authenticity of host '***' can't be established. RSA key fingerprint is ***. Are you sure you want to continue connecting?" requested to be shown to user had been answered.
Timeout that is passed to com.jcraft.jsch.Session#connect(int) could be easily exceeded during user answer and will fail the check here:
at com.jcraft.jsch.Session.write(Session.java:1343)
at com.jcraft.jsch.Session.send_newkeys(Session.java:695)
at com.jcraft.jsch.Session.connect(Session.java:348)
Steps to reproduce:
1. Be sure that the host we are connecting to is not in ~/.ssh/known_hosts (e.g. empty it)
2. Set com.jcraft.jsch.Session#setUserInfo(UserInfo) with implementation that returns result from com.jcraft.jsch.UserInfo#promptYesNo() in several seconds
3. Invoke com.jcraft.jsch.Session#connect(int) with timeout that is less than in step 2
4. Get JSchException
Is this right to consider both user answer time from UI and server interaction time in the same timeout value?