ObjectInputStream ois = new ObjectInputStream(fin);
for (int n=0; ; n++) {
Command o = (Command)ois.readObject();
System.out.println("#"+n+" : "+o);
if (o instanceof RPCRequest) {
RPCRequest request = (RPCRequest) o;
System.out.print(" (");
boolean first=true;
for (Object argument : request.getArguments()) {
if(first) first=false;
else System.out.print(",");
System.out.print(argument);
}
System.out.println(")");