KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > remoting > handler > mbean > ClientTest


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.test.remoting.handler.mbean;
8
9 import org.jboss.remoting.Client;
10 import org.jboss.remoting.InvokerLocator;
11
12 import junit.framework.TestCase;
13
14 /**
15  * @author <a HREF="mailto:tom.elrod@jboss.com">Tom Elrod</a>
16  */

17 public class ClientTest extends TestCase
18 {
19    // Default locator values
20
private static String JavaDoc transport = "socket";
21    private static String JavaDoc host = "localhost";
22    private static int port = 5400;
23
24    private String JavaDoc locatorURI = null;
25
26    public void testMakeInvocation() throws Throwable JavaDoc
27    {
28       if(locatorURI == null)
29       {
30          locatorURI = transport + "://" + host + ":" + port;
31       }
32       InvokerLocator locator = new InvokerLocator(locatorURI);
33       System.out.println("Calling remoting server with locator uri of: " + locatorURI);
34
35       Client remotingClient = new Client(locator);
36       Object JavaDoc response = remotingClient.invoke("Do something");
37
38       assertEquals(response, ServerTest.RESPONSE_VALUE);
39
40       remotingClient.disconnect();
41    }
42
43 }
Popular Tags