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