}
TestExternalizerFactory externalizerFactory = new TestExternalizerFactory();
Object o = new TestExternalizableInt(7);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ByteOutput byteOutput = Marshalling.createByteOutput(baos);
MarshallingConfiguration config = configuration.clone();
config.setClassExternalizerFactory(externalizerFactory);
Marshaller marshaller = testMarshallerProvider.create(config, byteOutput);
// if (marshaller instanceof SerialMarshaller) {
// throw new SkipException("TODO: Known issue - see JBMAR-50");
// }
marshaller.writeObject(o);
marshaller.writeObject(o);
marshaller.flush();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ByteInput byteInput = Marshalling.createByteInput(bais);
config = configuration.clone();
config.setClassExternalizerFactory(externalizerFactory);
Unmarshaller unmarshaller = testUnmarshallerProvider.create(config, byteInput);
Object o2 = unmarshaller.readObject();
assertEquals(o, o2);
Object o3 = unmarshaller.readObject();
assertSame(o2, o3);