@Converter
    public static byte[] toByteArray(IoBuffer buffer) {
        byte[] answer = new byte[buffer.remaining()];
        buffer.get(answer);
        return answer;
        // we should not mark and reset the buffer with mina
    }
@Test
    public void testToByteArray() {
        byte[] in = "Hello World".getBytes();
        IoBuffer bb = IoBuffer.wrap(in);

        byte[] out = MinaConverter.toByteArray(bb);

        for (int i = 0; i < out.length; i++) {
            assertEquals(in[i], out[i]);
        }
    }