Examples of MicroSocketClientInvoker


Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

     
      Iterator it = invocationHandler.callbackHandlers.iterator();
      ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) it.next();
      Client callbackClient = serverInvokerCallbackHandler.getCallbackClient();
      assertTrue(callbackClient.getInvoker() instanceof BisocketClientInvoker);
      MicroSocketClientInvoker clientInvoker = (MicroSocketClientInvoker) callbackClient.getInvoker();
      Field field = MicroSocketClientInvoker.class.getDeclaredField("pool");
      field.setAccessible(true);
      List pool = (List) field.get(clientInvoker);
//      field = MicroSocketClientInvoker.class.getDeclaredField("usedPooled");
//      field.setAccessible(true);
      assertEquals(0, pool.size());
//      Long usedPooled = (Long) field.get(clientInvoker);
//      assertEquals(0, usedPooled.intValue());
      assertEquals(0, clientInvoker.getNumberOfUsedConnections());
     
      int invocationCount = TEST_MAX_POOL_SIZE;
      for (int i = 0; i < invocationCount; i++)
      {
         client.invokeOneway(CALLBACK_TEST);
      }
     
      Thread.sleep(2000); // +2000
      assertEquals(invocationCount, callbackHandler.callbackCounter);
      assertEquals(0, pool.size());
//      usedPooled = (Long) field.get(clientInvoker);
//      assertEquals(invocationCount, usedPooled.intValue());
      assertEquals(invocationCount, clientInvoker.getNumberOfUsedConnections());
     
      for (int i = 0; i < invocationCount; i++)
      {
         client.invokeOneway(CALLBACK_TEST);
      }
     
      assertEquals(invocationCount, callbackHandler.callbackCounter);
      assertEquals(0, pool.size());
//      usedPooled = (Long) field.get(clientInvoker);
//      assertEquals(invocationCount, usedPooled.intValue());
      assertEquals(invocationCount, clientInvoker.getNumberOfUsedConnections());

      Thread.sleep(1000); // +3000
      assertEquals(invocationCount, callbackHandler.callbackCounter);
      assertEquals(0, pool.size());
//      usedPooled = (Long) field.get(clientInvoker);
//      assertEquals(invocationCount, usedPooled.intValue());
      assertEquals(invocationCount, clientInvoker.getNumberOfUsedConnections());

     
      Thread.sleep(3000); // +6000
      assertEquals(2 * invocationCount, callbackHandler.callbackCounter);
      assertEquals(0, pool.size());
//      usedPooled = (Long) field.get(clientInvoker);
//      assertEquals(invocationCount, usedPooled.intValue());
      assertEquals(invocationCount, clientInvoker.getNumberOfUsedConnections());

     
      Thread.sleep(4000); // +10000
      assertEquals(2 * invocationCount, callbackHandler.callbackCounter);
      assertEquals(invocationCount, pool.size());
//      usedPooled = (Long) field.get(clientInvoker);
//      assertEquals(0, usedPooled.intValue());
      assertEquals(0, clientInvoker.getNumberOfUsedConnections());

     
      client.removeListener(callbackHandler);
      client.disconnect();
   }
View Full Code Here

Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

     
      Iterator it = invocationHandler.callbackHandlers.iterator();
      ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) it.next();
      Client callbackClient = serverInvokerCallbackHandler.getCallbackClient();
      assertTrue(callbackClient.getInvoker() instanceof BisocketClientInvoker);
      MicroSocketClientInvoker clientInvoker = (MicroSocketClientInvoker) callbackClient.getInvoker();
      Field field = MicroSocketClientInvoker.class.getDeclaredField("pool");
      field.setAccessible(true);
      List pool = (List) field.get(clientInvoker);
//      field = MicroSocketClientInvoker.class.getDeclaredField("usedPooled");
      field.setAccessible(true);
      assertEquals(0, pool.size());
//      Long usedPooled = (Long) field.get(clientInvoker);
//      assertEquals(3, usedPooled.intValue());
      assertEquals(3, clientInvoker.getNumberOfUsedConnections());
     
      Thread.sleep(3000);
      assertEquals(3, pool.size());
//      usedPooled = (Long) field.get(clientInvoker);
//      assertEquals(0, usedPooled.intValue());
      assertEquals(0, clientInvoker.getNumberOfUsedConnections());
     
      client.removeListener(callbackHandler);
      client.disconnect();
      callbackConnector.stop();
   }
View Full Code Here

Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

      ServerInvokerCallbackHandler serverInvokerCallbackHandler2 = (ServerInvokerCallbackHandler) it.next();
      Client callbackClient1 = serverInvokerCallbackHandler1.getCallbackClient();
      Client callbackClient2 = serverInvokerCallbackHandler2.getCallbackClient();
      assertNotSame(callbackClient1, callbackClient2);
      assertTrue(callbackClient1.getInvoker() instanceof BisocketClientInvoker);
      MicroSocketClientInvoker clientInvoker1 = (MicroSocketClientInvoker) callbackClient1.getInvoker();
      assertTrue(callbackClient2.getInvoker() instanceof BisocketClientInvoker);
      MicroSocketClientInvoker clientInvoker2 = (MicroSocketClientInvoker) callbackClient2.getInvoker();
    
      Field field = MicroSocketClientInvoker.class.getDeclaredField("pool");
      field.setAccessible(true);
      List pool1 = (List) field.get(clientInvoker1);
      List pool2 = (List) field.get(clientInvoker2);
      assertEquals(0, pool1.size());
      assertEquals(0, pool2.size());
//      field = MicroSocketClientInvoker.class.getDeclaredField("usedPooled");
//      field.setAccessible(true);
//      Long usedPooled1 = (Long) field.get(clientInvoker1);
//      assertEquals(2, usedPooled1.intValue());
      assertEquals(2, clientInvoker1.getNumberOfUsedConnections());
//      Long usedPooled2 = (Long) field.get(clientInvoker2);
//      assertEquals(0, usedPooled2.intValue());
//      assertEquals(0, usedPooled2);
      assertEquals(0, clientInvoker2.getNumberOfUsedConnections());
     
      Thread.sleep(3000);
      assertEquals(2, pool1.size());
      assertEquals(0, pool2.size());
//      usedPooled1 = (Long) field.get(clientInvoker1);
//      assertEquals(0, usedPooled1.intValue());
      assertEquals(0, clientInvoker1.getNumberOfUsedConnections());
//      usedPooled2 = (Long) field.get(clientInvoker2);
//      assertEquals(2, usedPooled2.intValue());
      assertEquals(2, clientInvoker2.getNumberOfUsedConnections());
     
      Thread.sleep(3000);
      assertEquals(2, pool1.size());
      assertEquals(2, pool2.size());
//      usedPooled1 = (Long) field.get(clientInvoker1);
//      assertEquals(0, usedPooled1.intValue());
      assertEquals(0, clientInvoker1.getNumberOfUsedConnections());
//      usedPooled2 = (Long) field.get(clientInvoker2);
//      assertEquals(0, usedPooled2.intValue());
      assertEquals(0, clientInvoker2.getNumberOfUsedConnections());
     
      client.removeListener(callbackHandler);
      client.disconnect();
      callbackConnector1.stop();
      callbackConnector2.stop();
View Full Code Here

Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

      assertEquals(1, callbackHandlers.size());
      ServerInvokerCallbackHandler serverInvokerCallbackHandler;
      serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) callbackHandlers.values().toArray()[0];
      Client callbackClient = serverInvokerCallbackHandler.getCallbackClient();
      assertTrue(callbackClient.getInvoker() instanceof BisocketClientInvoker);
      MicroSocketClientInvoker clientInvoker = (MicroSocketClientInvoker) callbackClient.getInvoker();
      field = BisocketClientInvoker.class.getDeclaredField("controlSocket");
      field.setAccessible(true);
      Socket controlSocket = (Socket) field.get(clientInvoker);
      controlSocket.close();
      log.info("CLOSED CONTROL SOCKET");
View Full Code Here

Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

     
      Iterator it = invocationHandler.callbackHandlers.iterator();
      ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) it.next();
      Client callbackClient = serverInvokerCallbackHandler.getCallbackClient();
      assertTrue(callbackClient.getInvoker() instanceof BisocketClientInvoker);
      MicroSocketClientInvoker clientInvoker = (MicroSocketClientInvoker) callbackClient.getInvoker();
      Field field = BisocketClientInvoker.class.getDeclaredField("controlSocket");
      field.setAccessible(true);
      Socket controlSocketBefore = (Socket) field.get(clientInvoker);

      Thread.sleep(4 * TEST_PING_FREQUENCY);
 
View Full Code Here

Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

      Object o = config.get(ServerInvoker.TIMEOUT);
      assertEquals(ConnectionValidator.DEFAULT_PING_TIMEOUT, o);
     
      // Test ping retries.
      assertTrue(invoker instanceof MicroSocketClientInvoker);
      MicroSocketClientInvoker socketInvoker = (MicroSocketClientInvoker) invoker;
      int defaultPingRetries = Integer.parseInt(ConnectionValidator.DEFAULT_NUMBER_OF_PING_RETRIES);
      assertEquals(defaultPingRetries, socketInvoker.getNumberOfCallRetries());
        
      client.disconnect();
   }
View Full Code Here

Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

      Object o = config.get(ServerInvoker.TIMEOUT);
      assertEquals(ConnectionValidator.DEFAULT_PING_TIMEOUT, o);
     
      // Test ping retries.
      assertTrue(invoker instanceof MicroSocketClientInvoker);
      MicroSocketClientInvoker socketInvoker = (MicroSocketClientInvoker) invoker;
      int defaultPingRetries = Integer.parseInt(ConnectionValidator.DEFAULT_NUMBER_OF_PING_RETRIES);
      assertEquals(defaultPingRetries, socketInvoker.getNumberOfCallRetries());
        
      client.disconnect();
   }
View Full Code Here

Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

      Object o = config.get(ServerInvoker.TIMEOUT);
      assertEquals(ConnectionValidator.DEFAULT_PING_TIMEOUT, o);
     
      // Test ping retries.
      assertTrue(invoker instanceof MicroSocketClientInvoker);
      MicroSocketClientInvoker socketInvoker = (MicroSocketClientInvoker) invoker;
      int defaultPingRetries = Integer.parseInt(ConnectionValidator.DEFAULT_NUMBER_OF_PING_RETRIES);
      assertEquals(defaultPingRetries, socketInvoker.getNumberOfCallRetries());
        
      client.disconnect();
   }
View Full Code Here

Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

      Object o = config.get(ServerInvoker.TIMEOUT);
      assertEquals(ConnectionValidator.DEFAULT_PING_TIMEOUT, o);
     
      // Test ping retries.
      assertTrue(invoker instanceof MicroSocketClientInvoker);
      MicroSocketClientInvoker socketInvoker = (MicroSocketClientInvoker) invoker;
      int defaultPingRetries = Integer.parseInt(ConnectionValidator.DEFAULT_NUMBER_OF_PING_RETRIES);
      assertEquals(defaultPingRetries, socketInvoker.getNumberOfCallRetries());
        
      client.disconnect();
   }
View Full Code Here

Examples of org.jboss.remoting.transport.socket.MicroSocketClientInvoker

      Object o = config.get(ServerInvoker.TIMEOUT);
      assertEquals(ConnectionValidator.DEFAULT_PING_TIMEOUT, o);
     
      // Test ping retries.
      assertTrue(invoker instanceof MicroSocketClientInvoker);
      MicroSocketClientInvoker socketInvoker = (MicroSocketClientInvoker) invoker;
      int defaultPingRetries = Integer.parseInt(ConnectionValidator.DEFAULT_NUMBER_OF_PING_RETRIES);
      assertEquals(defaultPingRetries, socketInvoker.getNumberOfCallRetries());
        
      client.disconnect();
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.