if (obj instanceof Remote) {
// Yes, so make sure it is connected and converted
// to a stub (if needed)...
return Utility.autoConnect(obj,orb,true);
}
OutputStream out = (OutputStream)orb.create_output_stream();
out.write_value((Serializable)obj);
InputStream in = (InputStream)out.create_input_stream();
return in.read_value();