TestTuple<String, List<Integer>, Boolean> rv = tri2.show(234);
/*   TestTuple<String, List<Integer>, Boolean> rv = tri2.show(234);
   public static void main(String[] args)    { try {      System.out.println("Creating Connection");      conn = DBusConnection.getConnection(DBusConnection.SESSION);            System.out.println("Registering Name");      conn.requestBusName("foo.bar.Test");            /** This gets a remote object matching our bus name and exported object path. */      Peer peer = (Peer) conn.getRemoteObject("foo.bar.Test", "/Test", Peer.class);      DBus dbus = (DBus) conn.getRemoteObject("org.freedesktop.DBus", "/org/freedesktop/DBus", DBus.class);      System.out.print("Listening for signals...");      try {         /** This registers an instance of the test class as the signal handler for the TestSignal class. */         conn.addSigHandler(TestSignalInterface.TestSignal.class, new signalhandler());         String source = dbus.GetNameOwner("foo.bar.Test");         conn.addSigHandler(TestSignalInterface.TestArraySignal.class, source, peer, new arraysignalhandler());         badarraysignalhandler bash = new badarraysignalhandler();         conn.addSigHandler(TestSignalInterface.TestSignal.class, bash);         conn.removeSigHandler(TestSignalInterface.TestSignal.class, bash);         System.out.println("done");      } catch (MatchRuleInvalid MRI) {         test.fail("Failed to add handlers: "+MRI.getMessage());      } catch (DBusException DBe) {         test.fail("Failed to add handlers: "+DBe.getMessage());      }            System.out.println("Listening for Method Calls");      testclass tclass = new testclass(conn);      /** This exports an instance of the test class as the object /Test. */      conn.exportObject("/Test", tclass);            System.out.println("Sending Signal");      /** This creates an instance of the Test Signal, with the given object path, signal name and parameters, and broadcasts in on the Bus. */      conn.sendSignal(new TestSignalInterface.TestSignal("/foo/bar/Wibble", "Bar", new UInt32(42)));            System.out.println("Getting our introspection data");      /** This gets a remote object matching our bus name and exported object path. */      Introspectable intro = (Introspectable) conn.getRemoteObject("foo.bar.Test", "/", Introspectable.class);      /** Get introspection data */      String data = intro.Introspect();      if (null == data || !data.startsWith("<!DOCTYPE"))         fail("Introspection data invalid");      System.out.println("Got Introspection Data: \n"+data);            System.out.println("Pinging ourselves");      /** Call ping. */      for (int i = 0; i < 10; i++) {         long then = System.currentTimeMillis();         peer.Ping();         long now = System.currentTimeMillis();         System.out.println("Ping returned in "+(now-then)+"ms.");      }            System.out.println("Calling Method0/1");      /** This gets a remote object matching our bus name and exported object path. */      TestRemoteInterface tri = (TestRemoteInterface) conn.getPeerRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface.class);      System.out.println("Got Remote Object: "+tri);      /** Call the remote object and get a response. */      String rname = tri.getName();      System.out.println("Got Remote Name: "+rname);      if (!"This Is A Name!!".equals(rname))         fail("getName return value incorrect");      System.out.println("sending it to sleep");      tri.waitawhile();      System.out.println("frobnicating");      List<Long> ls = new Vector<Long>();      ls.add(2L);      ls.add(5L);      ls.add(71L);      Map<UInt16,Short> mus = new HashMap<UInt16,Short>();      mus.put(new UInt16(4), (short) 5);      mus.put(new UInt16(5), (short) 6);      mus.put(new UInt16(6), (short) 7);      Map<String,Map<UInt16,Short>> msmus = new HashMap<String,Map<UInt16,Short>>();      msmus.put("stuff", mus);      int rint = tri.frobnicate(ls, msmus, 13);      if (-5 != rint)         fail("frobnicate return value incorrect");       /** call something that throws */      try {         System.out.println("Throwing stuff");         tri.throwme();         test.fail("Method Execution should have failed");      } catch (TestException Te) {         System.out.println("Remote Method Failed with: "+Te.getClass().getName()+" "+Te.getMessage());         if (!Te.getMessage().equals("test"))            test.fail("Error message was not correct");      }           /** Try and call an invalid remote object */      try {         System.out.println("Calling Method2");         tri = (TestRemoteInterface) conn.getRemoteObject("foo.bar.NotATest", "/Moofle", TestRemoteInterface.class);         System.out.println("Got Remote Name: "+tri.getName());         test.fail("Method Execution should have failed");      } catch (ServiceUnknown SU) {         System.out.println("Remote Method Failed with: "+SU.getClass().getName()+" "+SU.getMessage());         if (!SU.getMessage().equals("The name foo.bar.NotATest was not provided by any .service files"))            test.fail("Error message was not correct");      }            /** Try and call an invalid remote object */      try {         System.out.println("Calling Method3");         tri = (TestRemoteInterface) conn.getRemoteObject("foo.bar.Test", "/Moofle", TestRemoteInterface.class);         System.out.println("Got Remote Name: "+tri.getName());         test.fail("Method Execution should have failed");      } catch (UnknownObject UO) {         System.out.println("Remote Method Failed with: "+UO.getClass().getName()+" "+UO.getMessage());         if (!UO.getMessage().equals("/Moofle is not an object provided by this process."))            test.fail("Error message was not correct");      }      System.out.println("Calling Method4/5/6/7");      /** This gets a remote object matching our bus name and exported object path. */      TestRemoteInterface2 tri2 = (TestRemoteInterface2) conn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface2.class);      /** Call the remote object and get a response. */      TestTuple<String, List<Integer>, Boolean> rv = tri2.show(234);      System.out.println("Show Response = "+rv);      if (!":1.0".equals(rv.a) ||            1 != rv.b.size() ||            1953 != rv.b.get(0) ||            true != rv.c.booleanValue())         fail("show return value incorrect");            System.out.println("Doing stuff asynchronously");      DBusAsyncReply<Boolean> stuffreply = (DBusAsyncReply<Boolean>) conn.callMethodAsync(tri2, "dostuff", new TestStruct("bar", new UInt32(52), new Variant<Boolean>(new Boolean(true))));      System.out.println("Checking bools");      if (tri2.check()) fail("bools are broken");               List<String> l = new Vector<String>();      l.add("hi");      l.add("hello");      l.add("hej");      l.add("hey");      l.add("aloha");      System.out.println("Sampling Arrays:");      List<Integer> is = tri2.sampleArray(l, new Integer[] { 1, 5, 7, 9 }, new long[] { 2, 6, 8, 12 });      System.out.println("sampleArray returned an array:");      for (Integer i: is)         System.out.println("--"+i);      if (is.size() != 5 ||            is.get(0).intValue() != -1 ||            is.get(1).intValue() != -5 ||            is.get(2).intValue() != -7 ||            is.get(3).intValue() != -12 ||            is.get(4).intValue() != -18)         fail("sampleArray return value incorrect");      System.out.println("Get This");      if (!tclass.equals(tri2.getThis(tri2)))         fail("Didn't get the correct this");            Boolean b = stuffreply.getReply();      System.out.println("Do stuff replied "+b);      if (true != b.booleanValue())         fail("dostuff return value incorrect");            System.out.print("Sending Array Signal...");      /** This creates an instance of the Test Signal, with the given object path, signal name and parameters, and broadcasts in on the Bus. */      conn.sendSignal(new TestSignalInterface.TestArraySignal("/Test", new TestStruct2(l, new Variant<UInt64>(new UInt64(567)))));            System.out.println("done");      System.out.print("testing custom serialization...");      Vector<Integer> v = new Vector<Integer>();      v.add(1);      v.add(2);      v.add(3);      TestSerializable<String> s = new TestSerializable<String>(1, "woo", v);      tri2.testSerializable((byte) 12, s, 13);            System.out.println("done");            System.out.print("testing recursion...");            if (!"This Is A Name!!".equals(tri2.recursionTest())) fail("recursion test failed");            System.out.println("done");      System.out.print("testing method overloading...");      tri = (TestRemoteInterface) conn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface.class);      if (1 != tri2.overload("foo")) test.fail("wrong overloaded method called");      if (2 != tri2.overload((byte) 0)) test.fail("wrong overloaded method called");      if (3 != tri2.overload()) test.fail("wrong overloaded method called");      if (4 != tri.overload()) test.fail("wrong overloaded method called");      System.out.println("done");      /** Pause while we wait for the DBus messages to go back and forth. */      Thread.sleep(1000);      System.out.println("Checking for outstanding errors");      DBusExecutionException DBEe = conn.getError();      if (null != DBEe) throw DBEe;          System.out.println("Disconnecting");      /** Disconnect from the bus. */      conn.disconnect();      conn = null;      if (!done1) fail("Signal handler 1 failed to be run");      if (!done2) fail("Signal handler 2 failed to be run");         } catch (Exception e) {      e.printStackTrace();      fail("Unexpected Exception Occurred");   }}