public void sendText(ByteBuffer[] payload) throws IOException {
checkBlockingAllowed();
long length = StreamSinkChannelUtils.payloadLength(payload);
StreamSinkChannel sink = createSink(length);
BlockingWritableByteChannel channel = new BlockingWritableByteChannel(sink);
long written = 0;
while(written < length) {
long w = channel.write(payload);
if (w > 0) {
written += w;
}
}
sink.shutdownWrites();
channel.flush();
channel.close();
}