ChannelFuture (@NotNull ByteBuf message, boolean binary) { if (channel.isOpen()) { return channel.writeAndFlush(binary ? new BinaryWebSocketFrame(message) : new TextWebSocketFrame(message)); } else { return channel.newFailedFuture(new ClosedChannelException()); } }