byte[] serializedProxy = baos.toByteArray();
oos.close();
baos.close();
// deserialize the proxy
ClassLoadingAwareObjectInputStream claois =
new ClassLoadingAwareObjectInputStream(new ByteArrayInputStream(serializedProxy));
// this is where it fails due to the rudimentary classloader selection
// in ClassLoadingAwareObjectInputStream
List deserializedProxy = (List) claois.readObject();
// assert the invocation worked
Assert.assertEquals("foo", deserializedProxy.get(0));
}