diff options
author | Florian Zschocke <florian.zschocke@devolo.de> | 2019-11-08 17:26:06 +0100 |
---|---|---|
committer | Florian Zschocke <florian.zschocke@devolo.de> | 2019-11-10 13:03:20 +0100 |
commit | abb041d2035e36c23191cf3c71640839e7708f8d (patch) | |
tree | 65eb5b90d79576acdeb320127fed732829a53044 /src/test/java/com/gitblit/tests/SshUnitTest.java | |
parent | c0e836dc8ec1b47de01ba2ae955715e76a48feaa (diff) | |
download | gitblit-abb041d2035e36c23191cf3c71640839e7708f8d.tar.gz gitblit-abb041d2035e36c23191cf3c71640839e7708f8d.zip |
Update SSHD dependency to version 1.1.0.
Diffstat (limited to 'src/test/java/com/gitblit/tests/SshUnitTest.java')
-rw-r--r-- | src/test/java/com/gitblit/tests/SshUnitTest.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/test/java/com/gitblit/tests/SshUnitTest.java b/src/test/java/com/gitblit/tests/SshUnitTest.java index 27b4ec73..dd354d85 100644 --- a/src/test/java/com/gitblit/tests/SshUnitTest.java +++ b/src/test/java/com/gitblit/tests/SshUnitTest.java @@ -24,11 +24,13 @@ import java.net.SocketAddress; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PublicKey; +import java.util.EnumSet; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.sshd.client.ServerKeyVerifier; import org.apache.sshd.client.SshClient; import org.apache.sshd.client.channel.ClientChannel; +import org.apache.sshd.client.future.AuthFuture; +import org.apache.sshd.client.keyverifier.ServerKeyVerifier; import org.apache.sshd.client.session.ClientSession; import org.apache.sshd.common.util.SecurityUtils; import org.junit.After; @@ -112,9 +114,11 @@ public abstract class SshUnitTest extends GitblitUnitTest { protected String testSshCommand(String cmd, String stdin) throws IOException, InterruptedException { SshClient client = getClient(); - ClientSession session = client.connect(username, "localhost", GitBlitSuite.sshPort).await().getSession(); + ClientSession session = client.connect(username, "localhost", GitBlitSuite.sshPort).verify().getSession(); session.addPublicKeyIdentity(rwKeyPair); - assertTrue(session.auth().await().isSuccess()); + AuthFuture authFuture = session.auth(); + assertTrue(authFuture.await()); + assertTrue(authFuture.isSuccess()); ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_EXEC, cmd); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -131,7 +135,7 @@ public abstract class SshUnitTest extends GitblitUnitTest { channel.setErr(err); channel.open(); - channel.waitFor(ClientChannel.CLOSED, 0); + channel.waitFor(EnumSet.of(ClientChannel.ClientChannelEvent.CLOSED), 0); String result = out.toString().trim(); channel.close(false); |