Package org.jboss.remoting.transport.bisocket

Examples of org.jboss.remoting.transport.bisocket.BisocketServerInvoker


      Map callbackConnectors = (Map) field.get(client);
      assertEquals(1, callbackConnectors.size());
      Set callbackConnectorSet = (Set) callbackConnectors.values().iterator().next();
      assertEquals(1, callbackConnectorSet.size());
      Connector callbackConnector = (Connector) callbackConnectorSet.iterator().next();
      BisocketServerInvoker invoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
      field = BisocketServerInvoker.class.getDeclaredField("controlConnectionThreadMap");
      field.setAccessible(true);
      Map controlConnectionThreadMap = (Map) field.get(invoker);
      assertEquals(1, controlConnectionThreadMap.size());
      Thread t = (Thread) controlConnectionThreadMap.values().iterator().next();
View Full Code Here


      Map callbackConnectors = (Map) field.get(client);
      assertEquals(1, callbackConnectors.size());
      Set callbackConnectorSet = (Set) callbackConnectors.values().iterator().next();
      assertEquals(1, callbackConnectorSet.size());
      Connector callbackConnector = (Connector) callbackConnectorSet.iterator().next();
      BisocketServerInvoker invoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
      field = BisocketServerInvoker.class.getDeclaredField("controlConnectionThreadMap");
      field.setAccessible(true);
      Map controlConnectionThreadMap = (Map) field.get(invoker);
      assertEquals(1, controlConnectionThreadMap.size());
      Collection controlConnectionThreads = controlConnectionThreadMap.values();
View Full Code Here

      assertEquals(1, callbackConnectorsMap.size());
      Set callbackConnectorsSet = (Set) callbackConnectorsMap.values().iterator().next();
      assertEquals(1, callbackConnectorsSet.size());
      Connector callbackConnector = (Connector) callbackConnectorsSet.iterator().next();
      assertTrue(connector.getServerInvoker() instanceof BisocketServerInvoker);
      BisocketServerInvoker callbackServerInvoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
      assertEquals(TEST_PING_FREQUENCY, callbackServerInvoker.getPingFrequency());
      assertEquals(TEST_PING_WINDOW_FACTOR, callbackServerInvoker.getPingWindowFactor());
      field = BisocketServerInvoker.class.getDeclaredField("pingWindow");
      field.setAccessible(true);
      int pingWindow = ((Integer) field.get(callbackServerInvoker)).intValue();
      assertEquals(TEST_PING_WINDOW_FACTOR * TEST_PING_FREQUENCY, pingWindow);
      assertEquals(TEST_MAX_RETRIES, callbackServerInvoker.getSocketCreationRetries());
      assertEquals(TEST_CONTROL_CONNECTION_RESTARTS, callbackServerInvoker.getControlConnectionRestarts());
      client.removeListener(callbackHandler);
      client.disconnect();
   }
View Full Code Here

      assertEquals(1, callbackConnectorsMap.size());
      Set callbackConnectorsSet = (Set) callbackConnectorsMap.values().iterator().next();
      assertEquals(1, callbackConnectorsSet.size());
      Connector callbackConnector = (Connector) callbackConnectorsSet.iterator().next();
      assertTrue(connector.getServerInvoker() instanceof BisocketServerInvoker);
      BisocketServerInvoker callbackServerInvoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
      assertEquals(TEST_PING_FREQUENCY, callbackServerInvoker.getPingFrequency());
      assertEquals(TEST_PING_WINDOW_FACTOR, callbackServerInvoker.getPingWindowFactor());
      field = BisocketServerInvoker.class.getDeclaredField("pingWindow");
      field.setAccessible(true);
      int pingWindow = ((Integer) field.get(callbackServerInvoker)).intValue();
      assertEquals(TEST_PING_WINDOW_FACTOR * TEST_PING_FREQUENCY, pingWindow);
      assertEquals(TEST_MAX_RETRIES, callbackServerInvoker.getSocketCreationRetries());
      assertEquals(TEST_CONTROL_CONNECTION_RESTARTS, callbackServerInvoker.getControlConnectionRestarts());
     
      client.removeListener(callbackHandler);
      client.disconnect();
   }
View Full Code Here

      config.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraServerConfig(config);
      connector = new Connector(serverLocator, config);
      connector.create();
      assertTrue(connector.getServerInvoker() instanceof BisocketServerInvoker);
      BisocketServerInvoker serverInvoker = (BisocketServerInvoker) connector.getServerInvoker();
      serverInvoker.setSecondaryBindPort(PORT);
      invocationHandler = new TestInvocationHandler();
      connector.addInvocationHandler("sample", invocationHandler);
      connector.start();
     
      // Create client.
View Full Code Here

      Set callbackConnectors = client.getCallbackConnectors(callbackHandler);
      assertEquals(1, callbackConnectors.size());
      Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
      Field field = BisocketServerInvoker.class.getDeclaredField("controlMonitorTimerTask");
      field.setAccessible(true);     
      BisocketServerInvoker serverInvoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
      TimerTask timerTask = (TimerTask) field.get(serverInvoker);
      assertNull(timerTask);
      log.info("ControlMonitorTimerTask was not created");
     
      // Verify PingTimerTask is not created.
View Full Code Here

      assertEquals(1, callbackConnectors.size());
      Set callbackConnectorSet = (Set) callbackConnectors.values().iterator().next();
      assertEquals(1, callbackConnectorSet.size());
      Connector callbackConnector = (Connector) callbackConnectorSet.iterator().next();
      assertTrue(callbackConnector.getServerInvoker() instanceof BisocketServerInvoker);
      BisocketServerInvoker callbackServerInvoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
      field = BisocketServerInvoker.class.getDeclaredField("controlConnectionThreadMap");
      field.setAccessible(true);
      Map controlConnectionThreadMap = (Map) field.get(callbackServerInvoker);
      assertEquals(1, controlConnectionThreadMap.size());
      Thread controlConnectionThread = (Thread) controlConnectionThreadMap.values().iterator().next();
View Full Code Here

      Set callbackConnectors = client.getCallbackConnectors(callbackHandler);
      assertEquals(1, callbackConnectors.size());
      Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
      Field field = BisocketServerInvoker.class.getDeclaredField("controlMonitorTimerTask");
      field.setAccessible(true);     
      BisocketServerInvoker serverInvoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
      TimerTask timerTask = (TimerTask) field.get(serverInvoker);
      assertNotNull(timerTask);
      log.info("ControlMonitorTimerTask was created");
     
      // Verify PingTimerTask is created.
      field = ServerInvoker.class.getDeclaredField("callbackHandlers");
      field.setAccessible(true);
      BisocketServerInvoker callbackServerInvoker = (BisocketServerInvoker) connector.getServerInvoker();
      Map callbackHandlers = (Map) field.get(callbackServerInvoker);
      assertEquals(1, callbackHandlers.size());
      Object o = callbackHandlers.values().iterator().next();
      Client callbackClient = ((ServerInvokerCallbackHandler) o).getCallbackClient();
      BisocketClientInvoker clientInvoker = (BisocketClientInvoker) callbackClient.getInvoker();
View Full Code Here

      // Verify failing PingTimerTask kicks thread out of BisocketClientInvoker.createSocket().
      // 1. Get client side control socket.
      Set callbackConnectors = client.getCallbackConnectors(callbackHandler);
      assertEquals(1, callbackConnectors.size());
      Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
      BisocketServerInvoker callbackServerInvoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
      Field field = BisocketServerInvoker.class.getDeclaredField("controlConnectionThreadMap");
      field.setAccessible(true);
      Map controlConnectionThreadMap = (Map) field.get(callbackServerInvoker);
      assertEquals(1, controlConnectionThreadMap.size());
      Thread controlConnectionThread = (Thread) controlConnectionThreadMap.values().iterator().next();
View Full Code Here

      metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
      client.addListener(callbackHandler, metadata);
     
      // Stop PingTimerTask on server.  This allows the possibility that the Timer
      // will be replaced.
      BisocketServerInvoker serverInvoker = (BisocketServerInvoker) connector.getServerInvoker();
      Field field = ServerInvoker.class.getDeclaredField("callbackHandlers");
      field.setAccessible(true);
      Map callbackHandlers = (Map) field.get(serverInvoker);
      assertEquals(1, callbackHandlers.size());
      ServerInvokerCallbackHandler serverInvokerCallbackHandler;
      serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) callbackHandlers.values().iterator().next();
      field = ServerInvokerCallbackHandler.class.getDeclaredField("callBackClient");
      field.setAccessible(true);
      Client callbackClient = (Client) field.get(serverInvokerCallbackHandler);
      assertNotNull(callbackClient);
      BisocketClientInvoker callbackClientInvoker = (BisocketClientInvoker) callbackClient.getInvoker();
      field = BisocketClientInvoker.class.getDeclaredField("pingTimerTask");
      field.setAccessible(true);
      TimerTask pingTimerTask1 = (TimerTask) field.get(callbackClientInvoker);
      BisocketClientInvoker ci = (BisocketClientInvoker) client.getInvoker();
      assertNotNull(pingTimerTask1);
      pingTimerTask1.cancel();
     
      // Cause recreation of PingTimerTask on server.  If call below to
      // createControlConnection() doesn't throw an exception, then the test passes.
      Thread.sleep(waitPeriod);
      field = Client.class.getDeclaredField("callbackConnectors");
      field.setAccessible(true);
      Map callbackConnectors = (Map) field.get(client);
      assertEquals(1, callbackConnectors.size());
      Set connectors = (Set) callbackConnectors.values().iterator().next();
      assertEquals(1, connectors.size());
      Connector callbackConnector = (Connector) connectors.iterator().next();
      BisocketServerInvoker callbackInvoker = (BisocketServerInvoker) callbackConnector.getServerInvoker();
      field = BisocketServerInvoker.class.getDeclaredField("controlConnectionThreadMap");
      field.setAccessible(true);
      Map controlConnectionThreadMap = (Map) field.get(callbackInvoker);
      assertEquals(1, controlConnectionThreadMap.size());
      Thread controlConnectionThread = (Thread) controlConnectionThreadMap.values().iterator().next();
      Class[] classes = BisocketServerInvoker.class.getDeclaredClasses();
      Class ControlConnectionThreadClass = null;
     
      for (int i = 0; i < classes.length; i++)
      {
         if (classes[i].toString().indexOf("ControlConnectionThread") != -1)
         {
            ControlConnectionThreadClass = classes[i];
            break;
         }
      }
     
      assertNotNull(ControlConnectionThreadClass);
      field = ControlConnectionThreadClass.getDeclaredField("listenerId");
      field.setAccessible(true);
      String listenerId = (String) field.get(controlConnectionThread);
      assertNotNull(listenerId);
      callbackInvoker.createControlConnection(listenerId, false);
      Thread.sleep(2000);
     
      // Get PingTimerTask and verify it has changed.
      field = BisocketClientInvoker.class.getDeclaredField("pingTimerTask");
      field.setAccessible(true);
View Full Code Here

TOP

Related Classes of org.jboss.remoting.transport.bisocket.BisocketServerInvoker

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.