1 package org.jacorb.test.orb.connection; 2 3 22 23 import junit.framework.*; 24 import junit.extensions.*; 25 26 import org.jacorb.test.common.*; 27 import org.jacorb.test.*; 28 import org.omg.CORBA.*; 29 import org.jacorb.orb.iiop.ClientIIOPConnection; 30 31 import java.util.*; 32 33 public class ClientConnectionTimeoutTest extends ClientServerTestCase 34 { 35 private TestIf server; 36 37 public ClientConnectionTimeoutTest(String name, ClientServerSetup setup) 38 { 39 super(name, setup); 40 } 41 42 public void setUp() throws Exception 43 { 44 server = TestIfHelper.narrow( setup.getServerObject() ); 45 } 46 47 public static Test suite() 48 { 49 TestSuite suite = new TestSuite( "Client connection idle-timeout tests" ); 50 51 Properties client_props = new Properties(); 52 client_props.setProperty( "jacorb.connection.client.idle_timeout", "1000" ); 53 54 ClientServerSetup setup = 55 new ClientServerSetup( suite, 56 "org.jacorb.test.orb.connection.ConnectionTimeoutServerImpl", 57 client_props, 58 null ); 59 60 suite.addTest( new ClientConnectionTimeoutTest( "testTimeout", setup )); 61 62 return setup; 63 } 64 65 public void testTimeout() 66 { 67 68 server.op(); 70 71 try 72 { 73 Thread.sleep( 2000 ); 75 } 76 catch( Exception e ){ e.printStackTrace(); } 77 78 assertTrue( ClientIIOPConnection.openTransports == 0 ); 82 83 server.onewayOp(); 85 86 try 87 { 88 Thread.sleep( 2000 ); 90 } 91 catch( Exception e ){ e.printStackTrace(); } 92 93 assertTrue( ClientIIOPConnection.openTransports == 0 ); 97 } 98 } 99 | Popular Tags |