diff --git a/src/main/java/net/schmizz/sshj/SSHClient.java b/src/main/java/net/schmizz/sshj/SSHClient.java index 78b91c5f7..dd0e38170 100644 --- a/src/main/java/net/schmizz/sshj/SSHClient.java +++ b/src/main/java/net/schmizz/sshj/SSHClient.java @@ -804,12 +804,12 @@ protected void onConnect() throws IOException { super.onConnect(); trans.init(getRemoteHostname(), getRemotePort(), getInputStream(), getOutputStream()); - doKex(); final KeepAlive keepAliveThread = conn.getKeepAlive(); if (keepAliveThread.isEnabled()) { ThreadNameProvider.setThreadName(conn.getKeepAlive(), trans); keepAliveThread.start(); } + doKex(); } /** diff --git a/src/main/java/net/schmizz/sshj/transport/TransportImpl.java b/src/main/java/net/schmizz/sshj/transport/TransportImpl.java index 58107c5b8..69632fc1b 100644 --- a/src/main/java/net/schmizz/sshj/transport/TransportImpl.java +++ b/src/main/java/net/schmizz/sshj/transport/TransportImpl.java @@ -420,9 +420,9 @@ public long write(SSHPacket payload) try { if (kexer.isKexOngoing()) { - // Only transport layer packets (1 to 49) allowed except SERVICE_REQUEST + // Only transport layer packets (1 to 49) allowed except SERVICE_REQUEST and IGNORE final Message m = Message.fromByte(payload.array()[payload.rpos()]); - if (!m.in(1, 49) || m == Message.SERVICE_REQUEST) { + if (!m.in(1, 49) || m == Message.SERVICE_REQUEST || m == Message.IGNORE) { assert m != Message.KEXINIT; kexer.waitForDone(); }