@Override public void flush(ChannelHandlerContext ctx) throws Exception { if (cBuf.isReadable()) { byte[] b = new byte[cBuf.readableBytes()]; cBuf.readBytes(b); cBuf.discardReadComponents(); byte[] wrapped = saslClient.wrap(b, 0, b.length); ByteBuf buf = ctx.alloc().ioBuffer(4 + wrapped.length); buf.writeInt(wrapped.length); buf.writeBytes(wrapped); ctx.write(buf); } ctx.flush(); }
@Override public CompositeByteBuf readBytes(ByteBuffer dst) { wrapped.readBytes(dst); return this; }
@Override public CompositeByteBuf readBytes(OutputStream out, int length) throws IOException { wrapped.readBytes(out, length); return this; }
@Override public CompositeByteBuf readBytes(byte[] dst, int dstIndex, int length) { wrapped.readBytes(dst, dstIndex, length); return this; }
@Override public ByteBuf readBytes(int length) { return wrapped.readBytes(length); }
@Override public int readBytes(FileChannel out, long position, int length) throws IOException { return wrapped.readBytes(out, position, length); }
@Override public CompositeByteBuf readBytes(ByteBuf dst) { wrapped.readBytes(dst); return this; }
@Override public CompositeByteBuf readBytes(byte[] dst) { wrapped.readBytes(dst); return this; }
@Override public CompositeByteBuf readBytes(ByteBuf dst, int length) { wrapped.readBytes(dst, length); return this; }
@Override public CompositeByteBuf readBytes(ByteBuf dst, int dstIndex, int length) { wrapped.readBytes(dst, dstIndex, length); return this; }
@Override public int readBytes(GatheringByteChannel out, int length) throws IOException { return wrapped.readBytes(out, length); }