@Test
  public void testFragmentedUnmarshalling() throws IOException {
    MarshallerFactory marshallerFactory = createMarshallerFactory();
    MarshallingConfiguration configuration = createMarshallingConfig();

    DecoderEmbedder<Object> decoder =
        new DecoderEmbedder<Object>(createDecoder(marshallerFactory, configuration, 0));

    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
    marshaller.start(Marshalling.createByteOutput(bout));
    marshaller.writeObject(testObject);
    marshaller.finish();
    marshaller.close();

    byte[] testBytes = bout.toByteArray();

    ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(testBytes);
    ChannelBuffer slice = buffer.readSlice(2);

    decoder.offer(slice);
    decoder.offer(buffer);
    assertTrue(decoder.finish());

    String unmarshalled = (String) decoder.poll();

    Assert.assertEquals(testObject, unmarshalled);

    Assert.assertNull(decoder.poll());
  }