@Test
public void testMarshalling() throws Exception {
@SuppressWarnings("RedundantStringConstructorCall")
String testObject = new String("test");
final MarshallerFactory marshallerFactory = createMarshallerFactory();
final MarshallingConfiguration configuration = createMarshallingConfig();
EmbeddedChannel ch = new EmbeddedChannel(createEncoder());
ch.writeOutbound(testObject);
assertTrue(ch.finish());
ByteBuf buffer = ch.readOutbound();
Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(configuration);
unmarshaller.start(Marshalling.createByteInput(truncate(buffer).nioBuffer()));
String read = (String) unmarshaller.readObject();
assertEquals(testObject, read);
assertEquals(-1, unmarshaller.read());