You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by GitBox <gi...@apache.org> on 2022/09/10 13:44:43 UTC

[GitHub] [mina-sshd] onyas commented on a diff in pull request #242: Fix: close session when timeout during connect

onyas commented on code in PR #242:
URL: https://github.com/apache/mina-sshd/pull/242#discussion_r967655211


##########
sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java:
##########
@@ -1530,6 +1532,29 @@ public void testConnectUsingIPv6Address() throws IOException {
         }
     }
 
+    @Test // see SSHD-1295
+    public void testConnectTimeout() throws Exception {
+        client.start();
+        try {
+            ConnectFuture future = client.connect(getCurrentTestName(), TEST_LOCALHOST, port);
+            try {
+                future.verify(1);
+                fail("Timeout expected");
+            } catch (InterruptedIOException | SshException e) {
+                ClientSession session = null;
+                try {
+                    session = future.verify(CONNECT_TIMEOUT).getSession();
+                } catch (SshException e2) {
+                    assertTrue("Expected a timeout, got " + e2, e2.getMessage().contains("timeout"));
+                }
+
+                assertNull("Session should not set since client timeout", session);

Review Comment:
   Thank you. By the way, why does it work locally but fail in GitHub Action? And need to add the delay operation. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org