author | dfuchs |
Wed, 14 Mar 2018 13:35:33 +0000 | |
branch | http-client-branch |
changeset 56304 | 065641767a75 |
parent 56295 | 898dfb226bd0 |
child 56314 | f92e7a8a189f |
permissions | -rw-r--r-- |
56263 | 1 |
/* |
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package jdk.internal.net.http.websocket; |
|
27 |
||
28 |
import jdk.internal.net.http.common.Utils; |
|
29 |
import jdk.internal.net.http.websocket.Frame.Opcode; |
|
30 |
||
31 |
import java.io.IOException; |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
32 |
import java.lang.System.Logger.Level; |
56263 | 33 |
import java.nio.ByteBuffer; |
34 |
import java.nio.CharBuffer; |
|
35 |
import java.nio.charset.CharacterCodingException; |
|
36 |
import java.nio.charset.CharsetEncoder; |
|
37 |
import java.nio.charset.CoderResult; |
|
38 |
import java.nio.charset.CodingErrorAction; |
|
39 |
import java.nio.charset.StandardCharsets; |
|
40 |
import java.security.SecureRandom; |
|
41 |
||
42 |
/* |
|
43 |
* A stateful producer of binary representations of WebSocket messages being |
|
44 |
* sent from the client to the server. |
|
45 |
* |
|
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
46 |
* An encoding method is given an original message and a byte buffer to put the |
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
47 |
* resulting bytes to. The method is called until it returns true. Then the |
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
48 |
* reset method is called. The whole sequence repeats with next message. |
56263 | 49 |
*/ |
50 |
public class MessageEncoder { |
|
51 |
||
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
52 |
private static final boolean DEBUG = Utils.DEBUG_WS; |
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
53 |
private static final System.Logger debug = |
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
54 |
Utils.getWebSocketLogger("[Output]"::toString, DEBUG); |
56263 | 55 |
|
56 |
private final SecureRandom maskingKeySource = new SecureRandom(); |
|
57 |
private final Frame.HeaderWriter headerWriter = new Frame.HeaderWriter(); |
|
58 |
private final Frame.Masker payloadMasker = new Frame.Masker(); |
|
59 |
private final CharsetEncoder charsetEncoder |
|
60 |
= StandardCharsets.UTF_8.newEncoder() |
|
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
61 |
.onMalformedInput(CodingErrorAction.REPORT) |
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
62 |
.onUnmappableCharacter(CodingErrorAction.REPORT); |
56263 | 63 |
/* |
64 |
* This buffer is used both to encode characters to UTF-8 and to calculate |
|
65 |
* the length of the resulting frame's payload. The length of the payload |
|
66 |
* must be known before the frame's header can be written. |
|
67 |
* For implementation reasons, this buffer must have a capacity of at least |
|
68 |
* the maximum size of a Close frame payload, which is 125 bytes |
|
69 |
* (or Frame.MAX_CONTROL_FRAME_PAYLOAD_LENGTH). |
|
70 |
*/ |
|
71 |
private final ByteBuffer intermediateBuffer = createIntermediateBuffer( |
|
72 |
Frame.MAX_CONTROL_FRAME_PAYLOAD_LENGTH); |
|
73 |
private final ByteBuffer headerBuffer = ByteBuffer.allocate( |
|
74 |
Frame.MAX_HEADER_SIZE_BYTES); |
|
75 |
||
76 |
private boolean started; |
|
77 |
private boolean flushing; |
|
78 |
private boolean moreText = true; |
|
79 |
private long headerCount; |
|
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
80 |
/* Has the previous frame got its fin flag set? */ |
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
81 |
private boolean previousFin = true; |
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
82 |
/* Was the previous frame TEXT or a CONTINUATION thereof? */ |
56263 | 83 |
private boolean previousText; |
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
84 |
private boolean closed; // TODO: too late, need to check it before accepting otherwise the queue might blow up |
56263 | 85 |
|
86 |
/* |
|
87 |
* How many bytes of the current message have been already encoded. |
|
88 |
* |
|
89 |
* Even though the user hands their buffers over to us, they still can |
|
90 |
* manipulate these buffers while we are getting data out of them. |
|
91 |
* The number of produced bytes guards us from such behaviour in the |
|
92 |
* case of messages that must be restricted in size (Ping, Pong and Close). |
|
93 |
* For other messages this measure provides a best-effort attempt to detect |
|
94 |
* concurrent changes to buffer. |
|
95 |
* |
|
96 |
* Making a shallow copy (duplicate/slice) and then checking the size |
|
97 |
* precondition on it would also solve the problem, but at the cost of this |
|
98 |
* extra copy. |
|
99 |
*/ |
|
100 |
private int actualLen; |
|
101 |
||
102 |
/* |
|
103 |
* How many bytes were originally there in the message, before the encoding |
|
104 |
* started. |
|
105 |
*/ |
|
106 |
private int expectedLen; |
|
107 |
||
108 |
/* Exposed for testing purposes */ |
|
109 |
protected ByteBuffer createIntermediateBuffer(int minSize) { |
|
110 |
int capacity = Utils.getIntegerNetProperty( |
|
111 |
"jdk.httpclient.websocket.intermediateBufferSize", 16384); |
|
112 |
return ByteBuffer.allocate(Math.max(minSize, capacity)); |
|
113 |
} |
|
114 |
||
115 |
public void reset() { |
|
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
116 |
// Do not reset the message stream state fields, e.g. previousFin, |
56263 | 117 |
// previousText. Just an individual message state: |
118 |
started = false; |
|
119 |
flushing = false; |
|
120 |
moreText = true; |
|
121 |
headerCount = 0; |
|
122 |
actualLen = 0; |
|
123 |
} |
|
124 |
||
125 |
/* |
|
126 |
* Encodes text messages by cutting them into fragments of maximum size of |
|
127 |
* intermediateBuffer.capacity() |
|
128 |
*/ |
|
129 |
public boolean encodeText(CharBuffer src, boolean last, ByteBuffer dst) |
|
130 |
throws IOException |
|
131 |
{ |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
132 |
debug.log(Level.DEBUG, "encodeText src.remaining()=%s, %s, %s", |
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
133 |
src.remaining(), last, dst); |
56263 | 134 |
if (closed) { |
135 |
throw new IOException("Output closed"); |
|
136 |
} |
|
137 |
if (!started) { |
|
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
138 |
if (!previousText && !previousFin) { |
56263 | 139 |
// Previous data message was a partial binary message |
140 |
throw new IllegalStateException("Unexpected text message"); |
|
141 |
} |
|
142 |
started = true; |
|
143 |
headerBuffer.position(0).limit(0); |
|
144 |
intermediateBuffer.position(0).limit(0); |
|
145 |
charsetEncoder.reset(); |
|
146 |
} |
|
147 |
while (true) { |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
148 |
debug.log(Level.DEBUG, "put"); |
56263 | 149 |
if (!putAvailable(headerBuffer, dst)) { |
150 |
return false; |
|
151 |
} |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
152 |
debug.log(Level.DEBUG, "mask"); |
56263 | 153 |
if (maskAvailable(intermediateBuffer, dst) < 0) { |
154 |
return false; |
|
155 |
} |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
156 |
debug.log(Level.DEBUG, "moreText"); |
56263 | 157 |
if (!moreText) { |
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
158 |
previousFin = last; |
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
159 |
previousText = true; |
56263 | 160 |
return true; |
161 |
} |
|
162 |
intermediateBuffer.clear(); |
|
163 |
CoderResult r = null; |
|
164 |
if (!flushing) { |
|
165 |
r = charsetEncoder.encode(src, intermediateBuffer, true); |
|
166 |
if (r.isUnderflow()) { |
|
167 |
flushing = true; |
|
168 |
} |
|
169 |
} |
|
170 |
if (flushing) { |
|
171 |
r = charsetEncoder.flush(intermediateBuffer); |
|
172 |
if (r.isUnderflow()) { |
|
173 |
moreText = false; |
|
174 |
} |
|
175 |
} |
|
176 |
if (r.isError()) { |
|
177 |
try { |
|
178 |
r.throwException(); |
|
179 |
} catch (CharacterCodingException e) { |
|
180 |
throw new IOException("Malformed text message", e); |
|
181 |
} |
|
182 |
} |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
183 |
debug.log(Level.DEBUG, "frame #%s", headerCount); |
56263 | 184 |
intermediateBuffer.flip(); |
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
185 |
Opcode opcode = previousFin && headerCount == 0 |
56263 | 186 |
? Opcode.TEXT : Opcode.CONTINUATION; |
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
187 |
boolean fin = last && !moreText; |
56291
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
188 |
setupHeader(opcode, fin, intermediateBuffer.remaining()); |
56263 | 189 |
headerCount++; |
190 |
} |
|
191 |
} |
|
192 |
||
193 |
private boolean putAvailable(ByteBuffer src, ByteBuffer dst) { |
|
194 |
int available = dst.remaining(); |
|
195 |
if (available >= src.remaining()) { |
|
196 |
dst.put(src); |
|
197 |
return true; |
|
198 |
} else { |
|
199 |
int lim = src.limit(); // save the limit |
|
200 |
src.limit(src.position() + available); |
|
201 |
dst.put(src); |
|
202 |
src.limit(lim); // restore the limit |
|
203 |
return false; |
|
204 |
} |
|
205 |
} |
|
206 |
||
207 |
public boolean encodeBinary(ByteBuffer src, boolean last, ByteBuffer dst) |
|
208 |
throws IOException |
|
209 |
{ |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
210 |
debug.log(Level.DEBUG, "encodeBinary %s, %s, %s", |
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
211 |
src, last, dst); |
56263 | 212 |
if (closed) { |
213 |
throw new IOException("Output closed"); |
|
214 |
} |
|
215 |
if (!started) { |
|
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
216 |
if (previousText && !previousFin) { |
56263 | 217 |
// Previous data message was a partial text message |
218 |
throw new IllegalStateException("Unexpected binary message"); |
|
219 |
} |
|
220 |
expectedLen = src.remaining(); |
|
56291
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
221 |
Opcode opcode = previousFin ? Opcode.BINARY : Opcode.CONTINUATION; |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
222 |
setupHeader(opcode, last, expectedLen); |
56269
234813fd33bc
http-client-branch: (WebSocket) test fix + output closure
prappo
parents:
56263
diff
changeset
|
223 |
previousFin = last; |
56263 | 224 |
previousText = false; |
225 |
started = true; |
|
226 |
} |
|
227 |
if (!putAvailable(headerBuffer, dst)) { |
|
228 |
return false; |
|
229 |
} |
|
230 |
int count = maskAvailable(src, dst); |
|
231 |
actualLen += Math.abs(count); |
|
232 |
if (count >= 0 && actualLen != expectedLen) { |
|
233 |
throw new IOException("Concurrent message modification"); |
|
234 |
} |
|
235 |
return count >= 0; |
|
236 |
} |
|
237 |
||
238 |
private int maskAvailable(ByteBuffer src, ByteBuffer dst) { |
|
239 |
int r0 = dst.remaining(); |
|
240 |
payloadMasker.transferMasking(src, dst); |
|
241 |
int masked = r0 - dst.remaining(); |
|
242 |
return src.hasRemaining() ? -masked : masked; |
|
243 |
} |
|
244 |
||
245 |
public boolean encodePing(ByteBuffer src, ByteBuffer dst) |
|
246 |
throws IOException |
|
247 |
{ |
|
248 |
if (closed) { |
|
249 |
throw new IOException("Output closed"); |
|
250 |
} |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
251 |
debug.log(Level.DEBUG, "encodePing %s, %s", src, dst); |
56263 | 252 |
if (!started) { |
253 |
expectedLen = src.remaining(); |
|
254 |
if (expectedLen > Frame.MAX_CONTROL_FRAME_PAYLOAD_LENGTH) { |
|
255 |
throw new IllegalArgumentException("Long message: " + expectedLen); |
|
256 |
} |
|
56291
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
257 |
setupHeader(Opcode.PING, true, expectedLen); |
56263 | 258 |
started = true; |
259 |
} |
|
260 |
if (!putAvailable(headerBuffer, dst)) { |
|
261 |
return false; |
|
262 |
} |
|
263 |
int count = maskAvailable(src, dst); |
|
264 |
actualLen += Math.abs(count); |
|
265 |
if (count >= 0 && actualLen != expectedLen) { |
|
266 |
throw new IOException("Concurrent message modification"); |
|
267 |
} |
|
268 |
return count >= 0; |
|
269 |
} |
|
270 |
||
271 |
public boolean encodePong(ByteBuffer src, ByteBuffer dst) |
|
272 |
throws IOException |
|
273 |
{ |
|
274 |
if (closed) { |
|
275 |
throw new IOException("Output closed"); |
|
276 |
} |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
277 |
debug.log(Level.DEBUG, "encodePong %s, %s", |
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
278 |
src, dst); |
56263 | 279 |
if (!started) { |
280 |
expectedLen = src.remaining(); |
|
281 |
if (expectedLen > Frame.MAX_CONTROL_FRAME_PAYLOAD_LENGTH) { |
|
282 |
throw new IllegalArgumentException("Long message: " + expectedLen); |
|
283 |
} |
|
56291
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
284 |
setupHeader(Opcode.PONG, true, expectedLen); |
56263 | 285 |
started = true; |
286 |
} |
|
287 |
if (!putAvailable(headerBuffer, dst)) { |
|
288 |
return false; |
|
289 |
} |
|
290 |
int count = maskAvailable(src, dst); |
|
291 |
actualLen += Math.abs(count); |
|
292 |
if (count >= 0 && actualLen != expectedLen) { |
|
293 |
throw new IOException("Concurrent message modification"); |
|
294 |
} |
|
295 |
return count >= 0; |
|
296 |
} |
|
297 |
||
298 |
public boolean encodeClose(int statusCode, CharBuffer reason, ByteBuffer dst) |
|
299 |
throws IOException |
|
300 |
{ |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
301 |
debug.log(Level.DEBUG, "encodeClose %s, reason.length=%s, %s", |
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
302 |
statusCode, reason.length(), dst); |
56263 | 303 |
if (closed) { |
304 |
throw new IOException("Output closed"); |
|
305 |
} |
|
306 |
if (!started) { |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
307 |
debug.log(Level.DEBUG, "reason size %s", reason.remaining()); |
56263 | 308 |
intermediateBuffer.position(0).limit(Frame.MAX_CONTROL_FRAME_PAYLOAD_LENGTH); |
309 |
intermediateBuffer.putChar((char) statusCode); |
|
310 |
CoderResult r = charsetEncoder.reset().encode(reason, intermediateBuffer, true); |
|
311 |
if (r.isUnderflow()) { |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
312 |
debug.log(Level.DEBUG, "flushing"); |
56263 | 313 |
r = charsetEncoder.flush(intermediateBuffer); |
314 |
} |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
315 |
debug.log(Level.DEBUG, "encoding result: %s", r); |
56263 | 316 |
if (r.isError()) { |
317 |
try { |
|
318 |
r.throwException(); |
|
319 |
} catch (CharacterCodingException e) { |
|
320 |
throw new IllegalArgumentException("Malformed reason", e); |
|
321 |
} |
|
322 |
} else if (r.isOverflow()) { |
|
323 |
// Here the 125 bytes size is ensured by the check for overflow |
|
324 |
throw new IllegalArgumentException("Long reason"); |
|
325 |
} else if (!r.isUnderflow()) { |
|
326 |
throw new InternalError(); // assertion |
|
327 |
} |
|
328 |
intermediateBuffer.flip(); |
|
56291
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
329 |
setupHeader(Opcode.CLOSE, true, intermediateBuffer.remaining()); |
56263 | 330 |
started = true; |
331 |
closed = true; |
|
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
332 |
debug.log(Level.DEBUG, "intermediateBuffer=%s", |
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
333 |
intermediateBuffer); |
56263 | 334 |
} |
335 |
if (!putAvailable(headerBuffer, dst)) { |
|
336 |
return false; |
|
337 |
} |
|
338 |
return maskAvailable(intermediateBuffer, dst) >= 0; |
|
339 |
} |
|
56291
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
340 |
|
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
341 |
private void setupHeader(Opcode opcode, boolean fin, long payloadLen) { |
56304
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
342 |
debug.log(Level.DEBUG, "frame opcode=%s fin=%s len=%s", |
065641767a75
http-client-branch: change websocket to use System.Logger for debug logging
dfuchs
parents:
56295
diff
changeset
|
343 |
opcode, fin, payloadLen); |
56291
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
344 |
headerBuffer.clear(); |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
345 |
int mask = maskingKeySource.nextInt(); |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
346 |
headerWriter.fin(fin) |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
347 |
.opcode(opcode) |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
348 |
.payloadLen(payloadLen) |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
349 |
.mask(mask) |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
350 |
.write(headerBuffer); |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
351 |
headerBuffer.flip(); |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
352 |
payloadMasker.mask(mask); |
c8c4c707ff3a
http-client-branch: (WebSocket) setting DEBUG to true; refactoring;
prappo
parents:
56269
diff
changeset
|
353 |
} |
56263 | 354 |
} |