author | chegar |
Wed, 07 Feb 2018 21:45:37 +0000 | |
branch | http-client-branch |
changeset 56092 | fd85b2bf2b0d |
parent 56089 | src/java.net.http/share/classes/java/net/http/internal/websocket/WebSocketImpl.java@42208b2f224e |
child 56263 | 4933a477d628 |
permissions | -rw-r--r-- |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
1 |
/* |
56024
de352132c7e8
http-client-branch: (WebSocket) a number of tests for exceptional completion
prappo
parents:
55992
diff
changeset
|
2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
4 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
10 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
15 |
* accompanied this code). |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
16 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
20 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
23 |
* questions. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
24 |
*/ |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
25 |
|
56092
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
26 |
package jdk.internal.net.http.websocket; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
27 |
|
56089
42208b2f224e
http-client-branch: move to standard package and module name
chegar
parents:
56058
diff
changeset
|
28 |
import java.net.http.WebSocket; |
56092
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
29 |
import jdk.internal.net.http.common.Demand; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
30 |
import jdk.internal.net.http.common.Log; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
31 |
import jdk.internal.net.http.common.MinimalFuture; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
32 |
import jdk.internal.net.http.common.SequentialScheduler; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
33 |
import jdk.internal.net.http.common.Utils; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
34 |
import jdk.internal.net.http.websocket.OpeningHandshake.Result; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
35 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
36 |
import java.io.IOException; |
48083 | 37 |
import java.lang.ref.Reference; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
38 |
import java.net.ProtocolException; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
39 |
import java.net.URI; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
40 |
import java.nio.ByteBuffer; |
56045 | 41 |
import java.util.Objects; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
42 |
import java.util.concurrent.CompletableFuture; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
43 |
import java.util.concurrent.CompletionStage; |
48083 | 44 |
import java.util.concurrent.TimeoutException; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
45 |
import java.util.concurrent.atomic.AtomicBoolean; |
48083 | 46 |
import java.util.concurrent.atomic.AtomicReference; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
47 |
import java.util.function.Function; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
48 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
49 |
import static java.util.Objects.requireNonNull; |
56092
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
50 |
import static jdk.internal.net.http.common.MinimalFuture.failedFuture; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
51 |
import static jdk.internal.net.http.websocket.StatusCodes.CLOSED_ABNORMALLY; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
52 |
import static jdk.internal.net.http.websocket.StatusCodes.NO_STATUS_CODE; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
53 |
import static jdk.internal.net.http.websocket.StatusCodes.isLegalToSendFromClient; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
54 |
import static jdk.internal.net.http.websocket.WebSocketImpl.State.BINARY; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
55 |
import static jdk.internal.net.http.websocket.WebSocketImpl.State.CLOSE; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
56 |
import static jdk.internal.net.http.websocket.WebSocketImpl.State.ERROR; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
57 |
import static jdk.internal.net.http.websocket.WebSocketImpl.State.IDLE; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
58 |
import static jdk.internal.net.http.websocket.WebSocketImpl.State.OPEN; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
59 |
import static jdk.internal.net.http.websocket.WebSocketImpl.State.PING; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
60 |
import static jdk.internal.net.http.websocket.WebSocketImpl.State.PONG; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
61 |
import static jdk.internal.net.http.websocket.WebSocketImpl.State.TEXT; |
fd85b2bf2b0d
http-client-branch: move implementation to jdk.internal.net.http
chegar
parents:
56089
diff
changeset
|
62 |
import static jdk.internal.net.http.websocket.WebSocketImpl.State.WAITING; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
63 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
64 |
/* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
65 |
* A WebSocket client. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
66 |
*/ |
48083 | 67 |
public final class WebSocketImpl implements WebSocket { |
68 |
||
69 |
enum State { |
|
70 |
OPEN, |
|
71 |
IDLE, |
|
72 |
WAITING, |
|
73 |
TEXT, |
|
74 |
BINARY, |
|
75 |
PING, |
|
76 |
PONG, |
|
77 |
CLOSE, |
|
78 |
ERROR; |
|
79 |
} |
|
80 |
||
81 |
private volatile boolean inputClosed; |
|
82 |
private volatile boolean outputClosed; |
|
83 |
||
84 |
private final AtomicReference<State> state = new AtomicReference<>(OPEN); |
|
85 |
||
86 |
/* Components of calls to Listener's methods */ |
|
87 |
private MessagePart part; |
|
88 |
private ByteBuffer binaryData; |
|
89 |
private CharSequence text; |
|
90 |
private int statusCode; |
|
91 |
private String reason; |
|
92 |
private final AtomicReference<Throwable> error = new AtomicReference<>(); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
93 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
94 |
private final URI uri; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
95 |
private final String subprotocol; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
96 |
private final Listener listener; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
97 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
98 |
private final AtomicBoolean outstandingSend = new AtomicBoolean(); |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
99 |
private final Transport<WebSocket> transport; |
48083 | 100 |
private final SequentialScheduler receiveScheduler = new SequentialScheduler(new ReceiveTask()); |
101 |
private final Demand demand = new Demand(); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
102 |
|
48083 | 103 |
public static CompletableFuture<WebSocket> newInstanceAsync(BuilderImpl b) { |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
104 |
Function<Result, WebSocket> newWebSocket = r -> { |
48083 | 105 |
WebSocket ws = newInstance(b.getUri(), |
106 |
r.subprotocol, |
|
107 |
b.getListener(), |
|
108 |
r.transport); |
|
109 |
// Make sure we don't release the builder until this lambda |
|
110 |
// has been executed. The builder has a strong reference to |
|
111 |
// the HttpClientFacade, and we want to keep that live until |
|
112 |
// after the raw channel is created and passed to WebSocketImpl. |
|
113 |
Reference.reachabilityFence(b); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
114 |
return ws; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
115 |
}; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
116 |
OpeningHandshake h; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
117 |
try { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
118 |
h = new OpeningHandshake(b); |
48083 | 119 |
} catch (Throwable e) { |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
120 |
return failedFuture(e); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
121 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
122 |
return h.send().thenApply(newWebSocket); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
123 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
124 |
|
48083 | 125 |
/* Exposed for testing purposes */ |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
126 |
static WebSocketImpl newInstance(URI uri, |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
127 |
String subprotocol, |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
128 |
Listener listener, |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
129 |
TransportFactory transport) { |
48083 | 130 |
WebSocketImpl ws = new WebSocketImpl(uri, subprotocol, listener, transport); |
131 |
// This initialisation is outside of the constructor for the sake of |
|
132 |
// safe publication of WebSocketImpl.this |
|
133 |
ws.signalOpen(); |
|
134 |
return ws; |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
135 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
136 |
|
48083 | 137 |
private WebSocketImpl(URI uri, |
138 |
String subprotocol, |
|
139 |
Listener listener, |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
140 |
TransportFactory transportFactory) { |
48083 | 141 |
this.uri = requireNonNull(uri); |
142 |
this.subprotocol = requireNonNull(subprotocol); |
|
143 |
this.listener = requireNonNull(listener); |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
144 |
this.transport = transportFactory.createTransport( |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
145 |
() -> WebSocketImpl.this, // What about escape of WebSocketImpl.this? |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
146 |
new SignallingMessageConsumer()); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
147 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
148 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
149 |
@Override |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
150 |
public CompletableFuture<WebSocket> sendText(CharSequence message, |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
151 |
boolean isLast) { |
56045 | 152 |
Objects.requireNonNull(message); |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
153 |
if (!outstandingSend.compareAndSet(false, true)) { |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
154 |
return failedFuture(new IllegalStateException("Send pending")); |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
155 |
} |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
156 |
CompletableFuture<WebSocket> cf = transport.sendText(message, isLast); |
55989 | 157 |
return cf.whenComplete((r, e) -> outstandingSend.set(false)); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
158 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
159 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
160 |
@Override |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
161 |
public CompletableFuture<WebSocket> sendBinary(ByteBuffer message, |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
162 |
boolean isLast) { |
56045 | 163 |
Objects.requireNonNull(message); |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
164 |
if (!outstandingSend.compareAndSet(false, true)) { |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
165 |
return failedFuture(new IllegalStateException("Send pending")); |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
166 |
} |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
167 |
CompletableFuture<WebSocket> cf = transport.sendBinary(message, isLast); |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
168 |
// Optimize? |
55992 | 169 |
// if (cf.isDone()) { |
170 |
// outstandingSend.set(false); |
|
171 |
// } else { |
|
172 |
// cf.whenComplete((r, e) -> outstandingSend.set(false)); |
|
173 |
// } |
|
55989 | 174 |
return cf.whenComplete((r, e) -> outstandingSend.set(false)); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
175 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
176 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
177 |
@Override |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
178 |
public CompletableFuture<WebSocket> sendPing(ByteBuffer message) { |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
179 |
return transport.sendPing(message); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
180 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
181 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
182 |
@Override |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
183 |
public CompletableFuture<WebSocket> sendPong(ByteBuffer message) { |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
184 |
return transport.sendPong(message); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
185 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
186 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
187 |
@Override |
48083 | 188 |
public CompletableFuture<WebSocket> sendClose(int statusCode, String reason) { |
56058 | 189 |
Objects.requireNonNull(reason); |
45119
decbbff9fdb4
8179021: Latest bugfixes to WebSocket/HPACK from the sandbox repo
prappo
parents:
43730
diff
changeset
|
190 |
if (!isLegalToSendFromClient(statusCode)) { |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
191 |
return failedFuture(new IllegalArgumentException("statusCode")); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
192 |
} |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
193 |
return sendClose0(statusCode, reason); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
194 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
195 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
196 |
/* |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
197 |
* Sends a Close message, then shuts down the output since no more |
48083 | 198 |
* messages are expected to be sent after this. |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
199 |
*/ |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
200 |
private CompletableFuture<WebSocket> sendClose0(int statusCode, String reason ) { |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
201 |
outputClosed = true; |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
202 |
return transport.sendClose(statusCode, reason) |
56024
de352132c7e8
http-client-branch: (WebSocket) a number of tests for exceptional completion
prappo
parents:
55992
diff
changeset
|
203 |
.whenComplete((result, error) -> { |
48083 | 204 |
try { |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
205 |
transport.closeOutput(); |
48083 | 206 |
} catch (IOException e) { |
207 |
Log.logError(e); |
|
208 |
} |
|
56024
de352132c7e8
http-client-branch: (WebSocket) a number of tests for exceptional completion
prappo
parents:
55992
diff
changeset
|
209 |
Throwable cause = Utils.getCompletionCause(error); |
de352132c7e8
http-client-branch: (WebSocket) a number of tests for exceptional completion
prappo
parents:
55992
diff
changeset
|
210 |
if (cause instanceof TimeoutException) { |
48083 | 211 |
try { |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
212 |
transport.closeInput(); |
48083 | 213 |
} catch (IOException e) { |
214 |
Log.logError(e); |
|
215 |
} |
|
216 |
} |
|
217 |
}); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
218 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
219 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
220 |
@Override |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
221 |
public void request(long n) { |
48083 | 222 |
if (demand.increase(n)) { |
223 |
receiveScheduler.runOrSchedule(); |
|
224 |
} |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
225 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
226 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
227 |
@Override |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
228 |
public String getSubprotocol() { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
229 |
return subprotocol; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
230 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
231 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
232 |
@Override |
48083 | 233 |
public boolean isOutputClosed() { |
234 |
return outputClosed; |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
235 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
236 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
237 |
@Override |
48083 | 238 |
public boolean isInputClosed() { |
239 |
return inputClosed; |
|
240 |
} |
|
241 |
||
242 |
@Override |
|
243 |
public void abort() { |
|
244 |
inputClosed = true; |
|
245 |
outputClosed = true; |
|
246 |
receiveScheduler.stop(); |
|
247 |
close(); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
248 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
249 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
250 |
@Override |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
251 |
public String toString() { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
252 |
return super.toString() |
48083 | 253 |
+ "[uri=" + uri |
254 |
+ (!subprotocol.isEmpty() ? ", subprotocol=" + subprotocol : "") |
|
255 |
+ "]"; |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
256 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
257 |
|
48083 | 258 |
/* |
259 |
* The assumptions about order is as follows: |
|
260 |
* |
|
261 |
* - state is never changed more than twice inside the `run` method: |
|
262 |
* x --(1)--> IDLE --(2)--> y (otherwise we're loosing events, or |
|
263 |
* overwriting parts of messages creating a mess since there's no |
|
264 |
* queueing) |
|
265 |
* - OPEN is always the first state |
|
266 |
* - no messages are requested/delivered before onOpen is called (this |
|
267 |
* is implemented by making WebSocket instance accessible first in |
|
268 |
* onOpen) |
|
269 |
* - after the state has been observed as CLOSE/ERROR, the scheduler |
|
270 |
* is stopped |
|
271 |
*/ |
|
272 |
private class ReceiveTask extends SequentialScheduler.CompleteRestartableTask { |
|
273 |
||
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
274 |
// Transport only asked here and nowhere else because we must make sure |
48083 | 275 |
// onOpen is invoked first and no messages become pending before onOpen |
276 |
// finishes |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
277 |
|
48083 | 278 |
@Override |
279 |
public void run() { |
|
280 |
while (true) { |
|
281 |
State s = state.get(); |
|
282 |
try { |
|
283 |
switch (s) { |
|
284 |
case OPEN: |
|
285 |
processOpen(); |
|
286 |
tryChangeState(OPEN, IDLE); |
|
287 |
break; |
|
288 |
case TEXT: |
|
289 |
processText(); |
|
290 |
tryChangeState(TEXT, IDLE); |
|
291 |
break; |
|
292 |
case BINARY: |
|
293 |
processBinary(); |
|
294 |
tryChangeState(BINARY, IDLE); |
|
295 |
break; |
|
296 |
case PING: |
|
297 |
processPing(); |
|
298 |
tryChangeState(PING, IDLE); |
|
299 |
break; |
|
300 |
case PONG: |
|
301 |
processPong(); |
|
302 |
tryChangeState(PONG, IDLE); |
|
303 |
break; |
|
304 |
case CLOSE: |
|
305 |
processClose(); |
|
306 |
return; |
|
307 |
case ERROR: |
|
308 |
processError(); |
|
309 |
return; |
|
310 |
case IDLE: |
|
311 |
if (demand.tryDecrement() |
|
312 |
&& tryChangeState(IDLE, WAITING)) { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
313 |
transport.request(1); |
48083 | 314 |
} |
315 |
return; |
|
316 |
case WAITING: |
|
317 |
// For debugging spurious signalling: when there was a |
|
318 |
// signal, but apparently nothing has changed |
|
319 |
return; |
|
320 |
default: |
|
321 |
throw new InternalError(String.valueOf(s)); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
322 |
} |
48083 | 323 |
} catch (Throwable t) { |
324 |
signalError(t); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
325 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
326 |
} |
48083 | 327 |
} |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
328 |
|
48083 | 329 |
private void processError() throws IOException { |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
330 |
transport.closeInput(); |
48083 | 331 |
receiveScheduler.stop(); |
332 |
Throwable err = error.get(); |
|
333 |
if (err instanceof FailWebSocketException) { |
|
334 |
int code1 = ((FailWebSocketException) err).getStatusCode(); |
|
335 |
err = new ProtocolException().initCause(err); |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
336 |
sendClose0(code1, "") |
48083 | 337 |
.whenComplete( |
338 |
(r, e) -> { |
|
339 |
if (e != null) { |
|
340 |
Log.logError(e); |
|
341 |
} |
|
342 |
}); |
|
343 |
} |
|
344 |
listener.onError(WebSocketImpl.this, err); |
|
345 |
} |
|
346 |
||
347 |
private void processClose() throws IOException { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
348 |
transport.closeInput(); |
48083 | 349 |
receiveScheduler.stop(); |
350 |
CompletionStage<?> readyToClose; |
|
351 |
readyToClose = listener.onClose(WebSocketImpl.this, statusCode, reason); |
|
352 |
if (readyToClose == null) { |
|
353 |
readyToClose = MinimalFuture.completedFuture(null); |
|
354 |
} |
|
355 |
int code; |
|
356 |
if (statusCode == NO_STATUS_CODE || statusCode == CLOSED_ABNORMALLY) { |
|
357 |
code = NORMAL_CLOSURE; |
|
358 |
} else { |
|
359 |
code = statusCode; |
|
360 |
} |
|
361 |
readyToClose.whenComplete((r, e) -> { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
362 |
sendClose0(code, "") |
48083 | 363 |
.whenComplete((r1, e1) -> { |
364 |
if (e1 != null) { |
|
365 |
Log.logError(e1); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
366 |
} |
48083 | 367 |
}); |
368 |
}); |
|
369 |
} |
|
370 |
||
371 |
private void processPong() { |
|
372 |
listener.onPong(WebSocketImpl.this, binaryData); |
|
373 |
} |
|
374 |
||
375 |
private void processPing() { |
|
376 |
// Let's make a full copy of this tiny data. What we want here |
|
377 |
// is to rule out a possibility the shared data we send might be |
|
378 |
// corrupted by processing in the listener. |
|
379 |
ByteBuffer slice = binaryData.slice(); |
|
380 |
ByteBuffer copy = ByteBuffer.allocate(binaryData.remaining()) |
|
381 |
.put(binaryData) |
|
382 |
.flip(); |
|
383 |
// Non-exclusive send; |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
384 |
CompletableFuture<WebSocket> pongSent = transport.sendPong(copy); |
48083 | 385 |
pongSent.whenComplete( |
386 |
(r, e) -> { |
|
387 |
if (e != null) { |
|
388 |
signalError(Utils.getCompletionCause(e)); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
389 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
390 |
} |
48083 | 391 |
); |
392 |
listener.onPing(WebSocketImpl.this, slice); |
|
393 |
} |
|
394 |
||
395 |
private void processBinary() { |
|
396 |
listener.onBinary(WebSocketImpl.this, binaryData, part); |
|
397 |
} |
|
398 |
||
399 |
private void processText() { |
|
400 |
listener.onText(WebSocketImpl.this, text, part); |
|
401 |
} |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
402 |
|
48083 | 403 |
private void processOpen() { |
404 |
listener.onOpen(WebSocketImpl.this); |
|
405 |
} |
|
406 |
} |
|
407 |
||
408 |
private void signalOpen() { |
|
409 |
receiveScheduler.runOrSchedule(); |
|
410 |
} |
|
411 |
||
412 |
private void signalError(Throwable error) { |
|
413 |
inputClosed = true; |
|
414 |
outputClosed = true; |
|
415 |
if (!this.error.compareAndSet(null, error) || !trySetState(ERROR)) { |
|
416 |
Log.logError(error); |
|
417 |
} else { |
|
418 |
close(); |
|
419 |
} |
|
420 |
} |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
421 |
|
48083 | 422 |
private void close() { |
423 |
try { |
|
424 |
try { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
425 |
transport.closeInput(); |
48083 | 426 |
} finally { |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
427 |
transport.closeOutput(); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
428 |
} |
48083 | 429 |
} catch (Throwable t) { |
430 |
Log.logError(t); |
|
431 |
} |
|
432 |
} |
|
433 |
||
434 |
/* |
|
435 |
* Signals a Close event (might not correspond to anything happened on the |
|
436 |
* channel, i.e. might be synthetic). |
|
437 |
*/ |
|
438 |
private void signalClose(int statusCode, String reason) { |
|
439 |
inputClosed = true; |
|
440 |
this.statusCode = statusCode; |
|
441 |
this.reason = reason; |
|
442 |
if (!trySetState(CLOSE)) { |
|
443 |
Log.logTrace("Close: {0}, ''{1}''", statusCode, reason); |
|
444 |
} else { |
|
445 |
try { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
446 |
transport.closeInput(); |
48083 | 447 |
} catch (Throwable t) { |
448 |
Log.logError(t); |
|
449 |
} |
|
450 |
} |
|
451 |
} |
|
452 |
||
453 |
private class SignallingMessageConsumer implements MessageStreamConsumer { |
|
454 |
||
455 |
@Override |
|
456 |
public void onText(CharSequence data, MessagePart part) { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
457 |
transport.acknowledgeReception(); |
48083 | 458 |
text = data; |
459 |
WebSocketImpl.this.part = part; |
|
460 |
tryChangeState(WAITING, TEXT); |
|
461 |
} |
|
462 |
||
463 |
@Override |
|
464 |
public void onBinary(ByteBuffer data, MessagePart part) { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
465 |
transport.acknowledgeReception(); |
48083 | 466 |
binaryData = data; |
467 |
WebSocketImpl.this.part = part; |
|
468 |
tryChangeState(WAITING, BINARY); |
|
469 |
} |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
470 |
|
48083 | 471 |
@Override |
472 |
public void onPing(ByteBuffer data) { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
473 |
transport.acknowledgeReception(); |
48083 | 474 |
binaryData = data; |
475 |
tryChangeState(WAITING, PING); |
|
476 |
} |
|
477 |
||
478 |
@Override |
|
479 |
public void onPong(ByteBuffer data) { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
480 |
transport.acknowledgeReception(); |
48083 | 481 |
binaryData = data; |
482 |
tryChangeState(WAITING, PONG); |
|
483 |
} |
|
484 |
||
485 |
@Override |
|
486 |
public void onClose(int statusCode, CharSequence reason) { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
487 |
transport.acknowledgeReception(); |
48083 | 488 |
signalClose(statusCode, reason.toString()); |
489 |
} |
|
490 |
||
491 |
@Override |
|
492 |
public void onComplete() { |
|
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
493 |
transport.acknowledgeReception(); |
48083 | 494 |
signalClose(CLOSED_ABNORMALLY, ""); |
495 |
} |
|
496 |
||
497 |
@Override |
|
498 |
public void onError(Throwable error) { |
|
499 |
signalError(error); |
|
500 |
} |
|
501 |
} |
|
502 |
||
503 |
private boolean trySetState(State newState) { |
|
504 |
while (true) { |
|
505 |
State currentState = state.get(); |
|
506 |
if (currentState == ERROR || currentState == CLOSE) { |
|
507 |
return false; |
|
508 |
} else if (state.compareAndSet(currentState, newState)) { |
|
509 |
receiveScheduler.runOrSchedule(); |
|
510 |
return true; |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
511 |
} |
48083 | 512 |
} |
513 |
} |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
514 |
|
48083 | 515 |
private boolean tryChangeState(State expectedState, State newState) { |
516 |
State witness = state.compareAndExchange(expectedState, newState); |
|
517 |
if (witness == expectedState) { |
|
518 |
receiveScheduler.runOrSchedule(); |
|
519 |
return true; |
|
520 |
} |
|
521 |
// This should be the only reason for inability to change the state from |
|
522 |
// IDLE to WAITING: the state has changed to terminal |
|
523 |
if (witness != ERROR && witness != CLOSE) { |
|
524 |
throw new InternalError(); |
|
525 |
} |
|
526 |
return false; |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
527 |
} |
55988
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
528 |
|
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
529 |
/* Exposed for testing purposes */ |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
530 |
protected final Transport<WebSocket> transport() { |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
531 |
return transport; |
7f1e0cf933a6
http-client-branch: (WebSocket) refactoring for the sake of extra test coverage
prappo
parents:
55973
diff
changeset
|
532 |
} |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
533 |
} |