in src/main/java/com/microsoft/azure/proton/transport/ws/impl/WebSocketImpl.java [555:584]
public ByteBuffer head() {
if (isWebSocketEnabled) {
switch (webSocketState) {
case PN_WS_CONNECTING:
case PN_WS_CONNECTED_PONG:
case PN_WS_CONNECTED_CLOSING:
return head;
case PN_WS_CONNECTED_FLOW:
underlyingOutputSize = underlyingOutput.pending();
if (underlyingOutputSize > 0) {
wrapBuffer(underlyingOutput.head(), outputBuffer);
webSocketHeaderSize = outputBuffer.position() - underlyingOutputSize;
head.limit(outputBuffer.position());
}
return head;
case PN_WS_NOT_STARTED:
case PN_WS_CLOSED:
case PN_WS_FAILED:
default:
return underlyingOutput.head();
}
} else {
return underlyingOutput.head();
}
}