1
package org.jboss.test.remoting.transport.rmi.connection.socketfactory;
3
import junit.framework.TestCase;
4
import org.jboss.remoting.Client;
5
import org.jboss.remoting.InvokerLocator;
8
* @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
10
public class SocketFactoryTestClient extends TestCase
12
// Default locator values
13
private static String transport = "rmi";
14
private static String host = "localhost";
15
private static int port = 5400;
17
public void testInvocations() throws Throwable
19
Client remotingClient = null;
25
String locatorURI = transport + "://" + host + ":" + port;
26
//String locatorURI = transport + "://" + host + ":" + port;
28
// create InvokerLocator with the url type string
29
// indicating the target remoting server to call upon.
30
InvokerLocator locator = new InvokerLocator(locatorURI);
31
System.out.println("Calling remoting server with locator uri of: " + locatorURI);
33
remotingClient = new Client(locator);
34
remotingClient.connect();
35
String request = "Do something";
36
System.out.println("Invoking server with request of '" + request + "'");
38
long startTime = System.currentTimeMillis();
40
Object response = remotingClient.invoke(request);
41
System.out.println("Invocation response: " + response);
46
if(remotingClient != null)
48
remotingClient.disconnect();
55
* Can pass transport and port to be used as parameters.
56
* Valid transports are 'rmi' and 'socket'.
60
public static void main(String[] args)
62
if(args != null && args.length == 3)
66
port = Integer.parseInt(args[2]);
68
SocketFactoryTestClient client = new SocketFactoryTestClient();
71
client.testInvocations();