--- old/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java 2021-02-18 17:05:57.000000000 +0300 +++ new/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java 2021-02-18 17:05:57.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -363,6 +363,10 @@ this.response = new HttpResponseImpl<>(currentreq, response, this.response, null, exch); Exchange oldExch = exch; + if (currentreq.isWebSocket()) { + // need to close the connection and open a new one. + exch.exchImpl.connection().close(); + } return exch.ignoreBody().handle((r,t) -> { previousreq = currentreq; currentreq = newrequest;