]> source.dussan.org Git - vaadin-framework.git/commitdiff
Re-try opening ssh tunnel if it fails the first time(s)
authorArtur Signell <artur@vaadin.com>
Thu, 27 Feb 2014 09:33:16 +0000 (11:33 +0200)
committerVaadin Code Review <review@vaadin.com>
Mon, 3 Mar 2014 12:51:45 +0000 (12:51 +0000)
Change-Id: I653db3a818435c023f0bbd8015d2bd1a35ed4e34

uitest/src/com/vaadin/tests/tb3/MultiBrowserTestWithProxy.java

index 0bb76889a079552c5c6024e8f5d4ce6ce436992b..1a1e507a4a90ec5afb94c523a448cb192b602b69 100755 (executable)
@@ -72,8 +72,23 @@ public abstract class MultiBrowserTestWithProxy extends MultiBrowserTest {
         if (proxySession != null) {
             return;
         }
-
-        createProxy(getProxyPort());
+        for (int i = 0; i < 10; i++) {
+            // Potential workaround for problem with establishing many ssh
+            // connections at the same time
+            try {
+                createProxy(getProxyPort());
+                break;
+            } catch (JSchException e) {
+                try {
+                    sleep(500);
+                } catch (InterruptedException e1) {
+                }
+                if (i == 9) {
+                    throw new RuntimeException(
+                            "All 10 attempts to connect a proxy failed", e);
+                }
+            }
+        }
     }
 
     private void createProxy(int proxyPort) throws JSchException {