test/jdk/java/net/httpclient/CancelledResponse.java
changeset 50985 cd41f34e548c
parent 49765 ee6f7a61f3a5
child 52121 934969c63223
child 56833 be0819373531
--- a/test/jdk/java/net/httpclient/CancelledResponse.java	Wed Jul 04 16:54:56 2018 +0200
+++ b/test/jdk/java/net/httpclient/CancelledResponse.java	Wed Jul 04 16:16:24 2018 +0100
@@ -339,9 +339,11 @@
                     Thread.sleep(10);
                 }
                 out.println("sent " + s);
-            } catch (SSLException | SocketException x) {
-                // if SSL then we might get a "Broken Pipe", otherwise
-                // a "Socket closed".
+            } catch (SSLException | SocketException | RuntimeException x) {
+                // if SSL then we might get a "Broken Pipe", or a
+                // RuntimeException wrapping an InvalidAlgorithmParameterException
+                // (probably if the channel is closed during the handshake),
+                // otherwise we get a "Socket closed".
                 boolean expected = cancelled.get();
                 if (sent > 0 && expected) {
                     System.out.println("Connection closed by peer as expected: " + x);
@@ -349,6 +351,7 @@
                 } else {
                     System.out.println("Unexpected exception (sent="
                             + sent + ", cancelled=" + expected + "): " + x);
+                    if (x instanceof RuntimeException) throw (RuntimeException) x;
                     throw new RuntimeException(x);
                 }
             } catch (IOException | InterruptedException e) {