}
}
});
sess.getFilterChain().addFirst("logger", new LoggingFilter());
BufferedWriteFilter bFilter = new BufferedWriteFilter(10);
sess.getFilterChain().addLast("buffer", bFilter);
IoBuffer data = IoBuffer.allocate(1);
for (byte i = 0; i < 20; i++) {
data.put((byte) (0x30 + i));
data.flip();
sess.write(data);
data.clear();
}
// Add one more byte to overflow the final buffer
data.put((byte) 0);
data.flip();
sess.write(data);
// Flush the final byte
bFilter.flush(sess);
sess.close(true);
}