diff options
author | Mark Spruiell <mes@zeroc.com> | 2017-06-30 11:12:39 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2017-06-30 11:12:39 -0700 |
commit | 173537b0376fe426459af9bf9d3c285139d97e0c (patch) | |
tree | 9b987e3406620cf46030fe43077a6011ab926959 /java | |
parent | Document .NET Strong Name and Authenticode signing (diff) | |
download | ice-173537b0376fe426459af9bf9d3c285139d97e0c.tar.bz2 ice-173537b0376fe426459af9bf9d3c285139d97e0c.tar.xz ice-173537b0376fe426459af9bf9d3c285139d97e0c.zip |
ICE-8183 - improve failure handling in Java IceSSL test
Diffstat (limited to 'java')
-rw-r--r-- | java/test/src/main/java/test/IceSSL/configuration/AllTests.java | 188 |
1 files changed, 168 insertions, 20 deletions
diff --git a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java index c04a9eb37a1..24b3bd4ea26 100644 --- a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java +++ b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java @@ -144,6 +144,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } comm.destroy(); @@ -169,6 +170,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -225,6 +227,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -246,6 +249,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -272,6 +276,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -329,6 +334,7 @@ public class AllTests } catch(Exception ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -358,6 +364,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -391,6 +398,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -421,6 +429,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -473,6 +482,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -495,6 +505,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -529,6 +540,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -579,6 +591,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -659,6 +672,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -736,6 +750,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -801,6 +816,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -820,6 +836,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -839,6 +856,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -866,6 +884,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -899,6 +918,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -928,6 +948,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -973,6 +994,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1010,6 +1032,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1026,6 +1049,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1066,6 +1090,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } test(verifier.invoked()); @@ -1089,6 +1114,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } test(verifier.invoked()); @@ -1121,6 +1147,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } test(verifier.invoked()); @@ -1174,6 +1201,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1239,6 +1267,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1272,6 +1301,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1304,6 +1334,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1335,6 +1366,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1358,6 +1390,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1385,6 +1418,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } } @@ -1412,6 +1446,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } comm.destroy(); @@ -1436,6 +1471,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } comm.destroy(); @@ -1479,6 +1515,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1503,6 +1540,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1524,6 +1562,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1555,6 +1594,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1587,6 +1627,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1621,6 +1662,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1652,6 +1694,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1677,6 +1720,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1719,6 +1763,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1740,6 +1785,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1781,6 +1827,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1821,6 +1868,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1921,6 +1969,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1941,6 +1990,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -1981,6 +2031,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -2001,6 +2052,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -2131,6 +2183,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -2173,6 +2226,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -2213,6 +2267,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -2241,6 +2296,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -2283,6 +2339,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -2349,6 +2406,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -2409,6 +2467,7 @@ public class AllTests } catch(com.zeroc.Ice.LocalException ex) { + ex.printStackTrace(); test(false); } fact.destroyServer(server); @@ -2419,41 +2478,130 @@ public class AllTests out.print("testing system CAs... "); out.flush(); { + // + // Retry a few times in case there are connectivity problems with demo.zeroc.com. + // + final int retryMax = 5; + final int retryDelay = 1000; + int retryCount = 0; + initData = createClientProps(defaultProperties); initData.properties.setProperty("IceSSL.VerifyDepthMax", "4"); initData.properties.setProperty("Ice.Override.Timeout", "5000"); // 5s timeout com.zeroc.Ice.Communicator comm = Util.initialize(initData); com.zeroc.Ice.ObjectPrx p = comm.stringToProxy("dummy:wss -h demo.zeroc.com -p 5064"); - try - { - p.ice_ping(); - test(false); - } - catch(com.zeroc.Ice.SecurityException ex) + while(true) { - // Expected, by default we don't check for system CAs. - } - catch(com.zeroc.Ice.LocalException ex) - { - test(false); + com.zeroc.Ice.LocalException retryEx = null; + try + { + p.ice_ping(); + test(false); + } + catch(com.zeroc.Ice.SecurityException ex) + { + // Expected, by default we don't check for system CAs. + break; + } + catch(com.zeroc.Ice.ConnectTimeoutException ex) + { + retryEx = ex; + } + catch(com.zeroc.Ice.SocketException ex) + { + retryEx = ex; + } + catch(com.zeroc.Ice.DNSException ex) + { + retryEx = ex; + } + catch(com.zeroc.Ice.LocalException ex) + { + ex.printStackTrace(); + test(false); + } + + if(retryEx != null) + { + if(++retryCount > retryMax) + { + retryEx.printStackTrace(); + test(false); + } + else + { + out.print("retrying... "); + out.flush(); + try + { + Thread.sleep(retryDelay); + } + catch(InterruptedException e) + { + break; + } + } + } } + comm.destroy(); + retryCount = 0; initData = createClientProps(defaultProperties); initData.properties.setProperty("IceSSL.VerifyDepthMax", "4"); initData.properties.setProperty("Ice.Override.Timeout", "5000"); // 5s timeout initData.properties.setProperty("IceSSL.UsePlatformCAs", "1"); comm = Util.initialize(initData); p = comm.stringToProxy("dummy:wss -h demo.zeroc.com -p 5064"); - try + while(true) { - com.zeroc.Ice.WSConnectionInfo info = (com.zeroc.Ice.WSConnectionInfo)p.ice_getConnection().getInfo(); - com.zeroc.IceSSL.ConnectionInfo sslinfo = (com.zeroc.IceSSL.ConnectionInfo)info.underlying; - test(sslinfo.verified); - } - catch(com.zeroc.Ice.LocalException ex) - { - ex.printStackTrace(); - test(false); + com.zeroc.Ice.LocalException retryEx = null; + try + { + com.zeroc.Ice.WSConnectionInfo info = + (com.zeroc.Ice.WSConnectionInfo)p.ice_getConnection().getInfo(); + com.zeroc.IceSSL.ConnectionInfo sslinfo = (com.zeroc.IceSSL.ConnectionInfo)info.underlying; + test(sslinfo.verified); + break; + } + catch(com.zeroc.Ice.ConnectTimeoutException ex) + { + retryEx = ex; + } + catch(com.zeroc.Ice.SocketException ex) + { + retryEx = ex; + } + catch(com.zeroc.Ice.DNSException ex) + { + retryEx = ex; + } + catch(com.zeroc.Ice.LocalException ex) + { + ex.printStackTrace(); + test(false); + } + + if(retryEx != null) + { + if(++retryCount > retryMax) + { + retryEx.printStackTrace(); + test(false); + } + else + { + out.print("retrying... "); + out.flush(); + try + { + Thread.sleep(retryDelay); + } + catch(InterruptedException e) + { + break; + } + } + } } comm.destroy(); } |