From 6249518e8b84ce9d8809374a652610600f13f0a6 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 27 Feb 2014 11:33:16 +0200 Subject: [PATCH] Re-try opening ssh tunnel if it fails the first time(s) Change-Id: I653db3a818435c023f0bbd8015d2bd1a35ed4e34 --- .../tests/tb3/MultiBrowserTestWithProxy.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTestWithProxy.java b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTestWithProxy.java index 0bb76889a0..1a1e507a4a 100755 --- a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTestWithProxy.java +++ b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTestWithProxy.java @@ -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 { -- 2.39.5