jdk/test/java/net/httpclient/http2/server/Http2TestServer.java
changeset 46157 f3c2dcb8d8fe
parent 45713 ee3f2cbfe23a
--- a/jdk/test/java/net/httpclient/http2/server/Http2TestServer.java	Tue Aug 15 19:19:50 2017 -0700
+++ b/jdk/test/java/net/httpclient/http2/server/Http2TestServer.java	Wed Aug 16 10:55:05 2017 +0100
@@ -201,7 +201,17 @@
                     InetSocketAddress addr = (InetSocketAddress) socket.getRemoteSocketAddress();
                     Http2TestServerConnection c = new Http2TestServerConnection(this, socket);
                     connections.put(addr, c);
-                    c.run();
+                    try {
+                        c.run();
+                    } catch(Throwable e) {
+                        // we should not reach here, but if we do
+                        // the connection might not have been closed
+                        // and if so then the client might wait
+                        // forever.
+                        connections.remove(addr, c);
+                        c.close();
+                        throw e;
+                    }
                 }
             } catch (Throwable e) {
                 if (!stopping) {