public class ServiceProxySerializationTest extends IOCTestCase
{
@Test
public void serialization_deserialization() throws Exception
{
Registry r = buildRegistry();
TypeCoercer proxy = r.getService(TypeCoercer.class);
byte[] serialized = serialize(proxy);
TypeCoercer proxy2 = deserialize(TypeCoercer.class, serialized);
assertSame(proxy2, proxy, "De-serialized proxy is same object if Registry unchanged.");
r.shutdown();
r = buildRegistry();
TypeCoercer proxy3 = deserialize(TypeCoercer.class, serialized);
assertNotNull(proxy3);
assertNotSame(proxy3, proxy, "New proxy should be different, as it is from a different Registry.");
r.shutdown();
}