1 7 package org.jboss.remoting.handler.mbean.service; 8 9 import org.jboss.remoting.Client; 10 import org.jboss.remoting.InvokerLocator; 11 12 15 public class ClientTest 16 { 17 private static String transport = "socket"; 19 private static String host = "localhost"; 20 private static int port = 5400; 21 22 public void makeInvocation(String locatorURI) throws Throwable 23 { 24 InvokerLocator locator = new InvokerLocator(locatorURI); 25 System.out.println("Calling remoting server with locator uri of: " + locatorURI); 26 27 Client remotingClient = new Client(locator); 28 Object response = remotingClient.invoke("Do something"); 29 30 System.out.println("Invocation response: " + response); 31 } 32 33 39 public static void main(String [] args) 40 { 41 if(args != null && args.length == 2) 42 { 43 transport = args[0]; 44 port = Integer.parseInt(args[1]); 45 } 46 String locatorURI = transport + "://" + host + ":" + port; 47 ClientTest clientTest = new ClientTest(); 48 try 49 { 50 clientTest.makeInvocation(locatorURI); 51 } 52 catch(Throwable e) 53 { 54 e.printStackTrace(); 55 } 56 } 57 58 } 59 | Popular Tags |