@Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {

        AsyncByteArrayFeeder streamFeeder = streamReader.getInputFeeder();
        logger.info("Decoding XMPP data.. ");

        byte[] buffer = new byte[in.readableBytes()];
        in.readBytes(buffer);
        logger.debug("Buffer length: " + buffer.length);
        try {
            streamFeeder.feedInput(buffer, 0, buffer.length);
        } catch (XMLStreamException exception) {
            logger.info(exception.getMessage());
            in.skipBytes(in.readableBytes());
            logger.info("Bytes skipped");
            throw exception;
        }

        while (streamReader.hasNext() && streamReader.next() != AsyncXMLStreamReader.EVENT_INCOMPLETE) {
            out.add(allocator.allocate(streamReader));
        }

    }
@Test
    public void testDecodeNoChannel() throws Exception {
        XmlStreamDecoder decoder = new XmlStreamDecoder();

        List<Object> list = Lists.newArrayList();
        decoder.decode(new ActiveChannelHandlerContextAdapter(),
                       Unpooled.buffer(), list);
        assertThat(list.size(), is(0));
    }