diff --git a/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java b/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java index 05d8034040..8a394640c7 100644 --- a/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java +++ b/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java @@ -32,7 +32,7 @@ public class SshdDemo { .getSession()) { session.addPasswordIdentity(password); session.auth() - .verify(5L, TimeUnit.SECONDS); + .verify(defaultTimeoutSeconds, TimeUnit.SECONDS); try (ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); ByteArrayOutputStream errorResponseStream = new ByteArrayOutputStream(); ClientChannel channel = session.createChannel(Channel.CHANNEL_SHELL)) { diff --git a/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java b/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java index 34a40318bb..8a6567bfee 100644 --- a/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java +++ b/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java @@ -42,10 +42,12 @@ public class JschDemo { throw new Exception(errorResponse); } } finally { - if (session != null) + if (session != null) { session.disconnect(); - if (channel != null) + } + if (channel != null) { channel.disconnect(); + } } return response; }