summaryrefslogtreecommitdiff
path: root/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_p2p_client.java
blob: aafbca4f2bd78b862c5430bbd5395629be53606f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
   D-Bus Java Implementation
   Copyright (c) 2005-2006 Matthew Johnson

   This program is free software; you can redistribute it and/or modify it
   under the terms of either the GNU Lesser General Public License Version 2 or the
   Academic Free Licence Version 2.1.

   Full licence texts are included in the COPYING file with this program.
*/
package org.freedesktop.dbus.test;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;

import org.freedesktop.DBus;
import org.freedesktop.dbus.DirectConnection;

public class test_p2p_client
{
   public static void main(String[] args) throws Exception
   {
      BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream("address")));
      String address = r.readLine();
      DirectConnection dc = new DirectConnection(address);
      System.out.println("Connected");
      TestRemoteInterface tri = (TestRemoteInterface) dc.getRemoteObject("/Test");
      System.out.println(tri.getName());
      System.out.println(tri.testfloat(new float[] { 17.093f, -23f, 0.0f, 31.42f }));
      
      try { 
         tri.throwme();
      } catch (TestException Te) {
         System.out.println("Caught TestException");
      }
      ((DBus.Peer) tri).Ping();
      System.out.println(((DBus.Introspectable) tri).Introspect());
      dc.disconnect();
      System.out.println("Disconnected");
   }      
}