1
package org.jboss.test.remoting.transporter.multiInterface;
3
import junit.framework.TestCase;
4
import org.jboss.remoting.InvokerLocator;
5
import org.jboss.remoting.transporter.TransporterClient;
7
import java.io.IOException;
10
* @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
12
public class TestClient extends TestCase
14
public void testClientCall() throws Exception
16
String locatorURI = "socket://localhost:5400";
17
InvokerLocator locator = new InvokerLocator(locatorURI);
18
TestServer test = (TestServer) TransporterClient.createTransporterClient(locator, TestServer.class);
19
Object response = test.processTestMessage("Hello");
20
System.out.println("response is: " + response);
21
assertEquals("response should be 'Hello - has been processed'", "Hello - has been processed", response);
23
// now make call that should throw exception
26
test.throwException();
27
assertTrue("Should have received IOException thrown by server.", false);
29
catch(IOException ioex)
31
assertTrue("Should have received IOException thrown by server.", true);
34
TransporterClient.destroyTransporterClient(test);
37
TestServer2 test2 = (TestServer2) TransporterClient.createTransporterClient(locator, TestServer2.class);
38
Object response2 = test2.doIt("foobar");
39
System.out.println("response2 is: " + response2);
40
assertEquals("response should be 'foobar'", "foobar", response2);
42
TransporterClient.destroyTransporterClient(test2);