protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
   if (desc == fooDesc) {
     super.writeClassDescriptor(integerDesc);
   } else if (desc == integerDesc) {
     super.writeClassDescriptor(fooDesc);
   } else {
     super.writeClassDescriptor(desc);
   }
 }
 protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
   Class cl = desc.forClass();
   if (ProxyFactory.isProxyClass(cl)) {
     writeBoolean(true);
     Class superClass = cl.getSuperclass();
     Class[] interfaces = cl.getInterfaces();
     byte[] signature = ProxyFactory.getFilterSignature(cl);
     String name = superClass.getName();
     writeObject(name);
     // we don't write the marker interface ProxyObject
     writeInt(interfaces.length - 1);
     for (int i = 0; i < interfaces.length; i++) {
       Class interfaze = interfaces[i];
       if (interfaze != ProxyObject.class && interfaze != Proxy.class) {
         name = interfaces[i].getName();
         writeObject(name);
       }
     }
     writeInt(signature.length);
     write(signature);
   } else {
     writeBoolean(false);
     super.writeClassDescriptor(desc);
   }
 }