});
enhancer.setInterfaces(new Class[]{Runnable.class});
enhancer.setUseFactory(true);
final Runnable orig = (Runnable)enhancer.create();
final String xml = xstream.toXML(orig);
final Factory deserialized = (Factory)xstream.fromXML(xml);
assertTrue("Not a Runnable anymore", deserialized instanceof Runnable);
Callback[] callbacks = deserialized.getCallbacks();
assertEquals(4, callbacks.length);
assertTrue(callbacks[0] instanceof DelegatingInterceptor);
assertTrue(callbacks[1] instanceof DelegatingHandler);
assertTrue(callbacks[2] instanceof DelegatingDispatcher);
assertTrue(callbacks[3] instanceof NoOp);