Package org.jboss.remoting

Examples of org.jboss.remoting.ConnectionNotifier


     
      // Get fields.
      ServerInvoker serverInvoker = connector.getServerInvoker();
      Field field = ServerInvoker.class.getDeclaredField("connectionNotifier");
      field.setAccessible(true);
      ConnectionNotifier connectionNotifier = (ConnectionNotifier) field.get(serverInvoker);
      field = ServerInvoker.class.getDeclaredField("callbackHandlers");
      field.setAccessible(true);
      Map callbackHandlers = (Map) field.get(serverInvoker);
     
      // Create client.
      HashMap clientConfig = new HashMap();
      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraClientConfig(clientConfig);
      Client client = null;
     
      for (int i = 0; i < COUNT; i++)
      {
         client = new Client(serverLocator, clientConfig);
         client.connect();
         log.info("client is connected");

         // Test connections.
         assertEquals("abc", client.invoke("abc"));
         log.info("connection is good");

         TestCallbackHandler callbackHandler = new TestCallbackHandler();
         client.addListener(callbackHandler, null, null, true);
      }
     
      field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
      field.setAccessible(true);
      LeasePinger pinger = (LeasePinger) field.get(client.getInvoker());
      field = LeasePinger.class.getDeclaredField("timerTask");
      field.setAccessible(true);
      TimerTask timerTask = (TimerTask) field.get(pinger);
      timerTask.cancel();
     
      synchronized(lock)
      {
         lock.wait();
      }
      Thread.sleep(2000);
     
      assertEquals(COUNT, TestConnectionListener.count);
      assertEquals(1, connectionNotifier.size());
      assertTrue(callbackHandlers.isEmpty());
     
      log.info(getName() + " PASSES");
   }
View Full Code Here


     
      // Get fields.
      ServerInvoker serverInvoker = connector.getServerInvoker();
      Field field = ServerInvoker.class.getDeclaredField("connectionNotifier");
      field.setAccessible(true);
      ConnectionNotifier connectionNotifier = (ConnectionNotifier) field.get(serverInvoker);
      field = ServerInvoker.class.getDeclaredField("callbackHandlers");
      field.setAccessible(true);
      Map callbackHandlers = (Map) field.get(serverInvoker);
     
      // Create client.
      HashMap clientConfig = new HashMap();
      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraClientConfig(clientConfig);
      Client client = null;
     
      for (int i = 0; i < COUNT; i++)
      {
         client = new Client(serverLocator, clientConfig);
         client.connect();
         log.info("client is connected");

         // Test connections.
         assertEquals("abc", client.invoke("abc"));
         log.info("connection is good");

         TestCallbackHandler callbackHandler = new TestCallbackHandler();
         client.addListener(callbackHandler, null, null, true);
      }
     
      field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
      field.setAccessible(true);
      LeasePinger pinger = (LeasePinger) field.get(client.getInvoker());
      field = LeasePinger.class.getDeclaredField("timerTask");
      field.setAccessible(true);
      TimerTask timerTask = (TimerTask) field.get(pinger);
      timerTask.cancel();
     
      synchronized(lock)
      {
         lock.wait();
      }
      Thread.sleep(2000);
     
      assertEquals(COUNT, TestConnectionListener.count);
      assertEquals(1, connectionNotifier.size());
      assertTrue(callbackHandlers.isEmpty());
     
      log.info(getName() + " PASSES");
   }
View Full Code Here

TOP

Related Classes of org.jboss.remoting.ConnectionNotifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.