// we need to let protocol handler execute extensions if there are any
if (protocolHandler.hasExtensions()) {
byte[] tempFrame;
final Frame dataFrame = new BinaryFrame(byteArrayMessage, false, true);
final ByteBuffer byteBuffer = webSocket.getProtocolHandler().frame(dataFrame);
tempFrame = new byte[byteBuffer.remaining()];
byteBuffer.get(tempFrame);
final Future<Frame> frameFuture = webSocket.sendRawFrame(ByteBuffer.wrap(tempFrame));
futures.put(e.getValue(), frameFuture);
} else {
if (frame == null) {
final Frame dataFrame = new BinaryFrame(byteArrayMessage, false, true);
final ByteBuffer byteBuffer = webSocket.getProtocolHandler().frame(dataFrame);
frame = new byte[byteBuffer.remaining()];
byteBuffer.get(frame);
}