// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class TestTest {
   private static void test(int i, StringBuffer sb) {
       i += 2;
       sb.append("B");
   }
   public static void main(String[] args) {
      try {
         Test t = (Test) Naming.lookup("test");
         int i = 1;
         StringBuffer sb = new StringBuffer("A");
         System.out.println(i + " " + sb);
         test(i, sb);
         System.out.println(i + " " + sb);
         t.test(i, sb);
         System.out.println(i + " " + sb);
      } catch (MalformedURLException e) {
         e.printStackTrace();
      } catch (RemoteException e) {
         e.printStackTrace();
      } catch (NotBoundException e) {
         e.printStackTrace();
      }
   }
}
