throw new AssertionError("Received: " + textFrame.text() + " expected: MESSAGE #" + receivedMessages);
}
receivedMessages++;
} else if (frame instanceof BinaryWebSocketFrame) {
BinaryWebSocketFrame binaryFrame = (BinaryWebSocketFrame) frame;
ByteBuffer bytes = binaryFrame.content().nioBuffer();
String message = Charset.forName("UTF8").decode(bytes).toString();
System.out.println("WebSocket Client received binary message: " + message );
if (!message.equals("BINARY MESSAGE #" + binrayReceivedMessages)) {
throw new AssertionError("Received: " + message + " expected: BINARY MESSAGE #" + receivedMessages);