@Test
  public void testSimpleUnmarshalling() 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();

    decoder.offer(ChannelBuffers.wrappedBuffer(testBytes));
    assertTrue(decoder.finish());

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

    Assert.assertEquals(testObject, unmarshalled);

    Assert.assertNull(decoder.poll());
  }
  @Test
  public void testTooBigObject() throws IOException {
    MarshallerFactory marshallerFactory = createMarshallerFactory();
    MarshallingConfiguration configuration = createMarshallingConfig();

    MarshallingDecoder mDecoder = createDecoder(marshallerFactory, configuration, 1);
    DecoderEmbedder<Object> decoder = new DecoderEmbedder<Object>(mDecoder);

    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();

    try {
      decoder.offer(ChannelBuffers.wrappedBuffer(testBytes));
      fail();
    } catch (CodecEmbedderException e) {
      assertEquals(TooLongFrameException.class, e.getCause().getClass());
    }
  }