public void wake() {
try {
if (isDirectChannelOpen()) {
UnwrappedByteArrayOutputStream outputStream = new UnwrappedByteArrayOutputStream();
buffer.read(outputStream, bufferColor, new BufferHelper.MultiMessageHandlerCallback());
directSocketChannel.write(new TextWebSocketFrame(new String(outputStream.toByteArray(), 0, outputStream.size())));
}
else {
BufferHelper.encodeAndWriteNoop(buffer, bufferColor);
}