The constructor in SshMsgKexInit is not thread safe. Calls to sortAlgorithmList modify the static variables that are passed in from the various Factory classes. The bug was isolated after seeing the exception below.
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at java.util.ArrayList.fastRemove(Unknown Source)
at java.util.ArrayList.remove(Unknown Source)
at com.sshtools.j2ssh.transport.SshMsgKexInit.sortAlgorithmList(SshMsgKexInit.java:345)
at com.sshtools.j2ssh.transport.SshMsgKexInit.<init>(SshMsgKexInit.java:102)
at com.sshtools.j2ssh.transport.TransportProtocolCommon.createLocalKexInit(TransportProtocolCommon.java:720)
at com.sshtools.j2ssh.transport.TransportProtocolCommon.sendKeyExchangeInit(TransportProtocolCommon.java:780)
at com.sshtools.j2ssh.transport.TransportProtocolCommon.startBinaryPacketProtocol(TransportProtocolCommon.java:993)
at com.sshtools.j2ssh.transport.TransportProtocolCommon.run(TransportProtocolCommon.java:377)
at java.lang.Thread.run(Unknown Source)
SshMsgKexInit diff