1 7 package org.jboss.test.remoting.exception.cannotconnect.http; 8 9 import org.jboss.logging.Logger; 10 import org.jboss.remoting.CannotConnectException; 11 import org.jboss.remoting.Client; 12 import org.jboss.remoting.InvokerLocator; 13 import org.jboss.remoting.invocation.NameBasedInvocation; 14 15 import junit.framework.TestCase; 16 17 20 public class CannotConnectTestCase extends TestCase 21 { 22 private static final Logger log = Logger.getLogger(CannotConnectTestCase.class); 23 24 public void testCannotConnect() 25 { 26 27 try 28 { 29 log.debug("running testCannotConnect()"); 30 31 InvokerLocator locator = new InvokerLocator("http://localhost:8823"); 32 Client client = new Client(locator, "mock"); 33 client.connect(); 34 35 log.debug("client.getInvoker().getLocator()" + client.getInvoker().getLocator()); 36 37 Object ret = client.invoke(new NameBasedInvocation("foo", 38 new Object []{"bar"}, 39 new String []{String .class.getName()}), 40 null); 41 } 42 catch(CannotConnectException cce) 43 { 44 log.debug("Got CannotConnectException as expected."); 45 assertTrue(true); 46 } 47 catch(Throwable tr) 48 { 49 tr.printStackTrace(); 50 assertTrue("Did not catch CannotConnectException as expected.", false); 51 } 52 } 53 } | Popular Tags |