Package org.jboss.remoting

Examples of org.jboss.remoting.ConnectionValidator$ConnectionCheckThread


      Integer i = (Integer) client.invoke(new Integer(7));
      assertEquals(8, i.intValue());
      client.addConnectionListener(this);
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
      ConnectionValidator cv = (ConnectionValidator) field.get(client);
      assertNotNull(cv);
      field = ConnectionValidator.class.getDeclaredField("stopped");
      field.setAccessible(true);
      boolean stopped = ((Boolean) field.get(cv)).booleanValue();
      assertFalse(stopped);
     
      cv.stop();
     
      stopped = ((Boolean) field.get(cv)).booleanValue();
      assertTrue(stopped);
      log.info(getName() + " PASSES");
   }
View Full Code Here


      Integer i = (Integer) client.invoke(new Integer(7));
      assertEquals(8, i.intValue());
      client.addConnectionListener(this);
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
      ConnectionValidator cv = (ConnectionValidator) field.get(client);
      assertNotNull(cv);
      field = ConnectionValidator.class.getDeclaredField("stopped");
      field.setAccessible(true);
      boolean stopped = ((Boolean) field.get(cv)).booleanValue();
      assertFalse(stopped);
     
      cv.cancel();
     
      stopped = ((Boolean) field.get(cv)).booleanValue();
      assertTrue(stopped);
      log.info(getName() + " PASSES");
   }
View Full Code Here

      log.info("connections are good");
     
      // Verify Clients share ConnectionValidator.
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
      ConnectionValidator connectionValidator1 = (ConnectionValidator) field.get(client1);
      ConnectionValidator connectionValidator2 = (ConnectionValidator) field.get(client2);
      assertSame(connectionValidator1, connectionValidator2);
     
      // Test client side connection failure notifications.
      int wait = (PING_PERIODS_TO_WAIT + 1) * VALIDATOR_PING_PERIOD + VALIDATOR_PING_TIMEOUT + 2000;
      log.info(getName() + " going to sleep for " + wait + " ms");
View Full Code Here

public class ConnectionValidatorTestCase extends TestCase
{

   public void testShouldDisallowDirectRun()
   {
      ConnectionValidator cv = new ConnectionValidator(new Client() {
         public Map getConfiguration()
         {
            return null;
         }

         public ClientInvoker getInvoker()
         {
            try
            {
               return new MicroRemoteClientInvoker(
                     new InvokerLocator("http://dummy:65535/dummy/")) {

                  public String getSessionId()
                  {
                     return "dummyId";
                  }

                  protected String getDefaultDataType()
                  {
                     throw new UnsupportedOperationException();
                  }

                  protected void handleConnect() throws ConnectionFailedException
                  {
                     throw new UnsupportedOperationException();
                  }

                  protected void handleDisconnect()
                  {
                     throw new UnsupportedOperationException();
                  }

                  protected Object transport(String sessionId, Object invocation, Map metadata, Marshaller marshaller,
                        UnMarshaller unmarshaller) throws IOException, ConnectionFailedException, ClassNotFoundException
                  {
                     throw new UnsupportedOperationException();
                  }
               };
            }
            catch (MalformedURLException e)
            {
               throw new RuntimeException(e);
            }
         }
      });

      try
      {
         cv.run();
         fail("Should throw IllegalStateException");
      } catch (IllegalStateException e) {
         // Expected
      }
   }
View Full Code Here

      client.addConnectionListener(listener);
     
      // Test pingPeriod.
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
      ConnectionValidator validator = (ConnectionValidator) field.get(client);
      field = ConnectionValidator.class.getDeclaredField("pingPeriod");
      field.setAccessible(true);
      long pingPeriod = ((Long) field.get(validator)).longValue();
      assertEquals(ConnectionValidator.DEFAULT_PING_PERIOD, pingPeriod);
     
View Full Code Here

      client.addConnectionListener(listener, 3456);
     
      // Test pingPeriod.
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
      ConnectionValidator validator = (ConnectionValidator) field.get(client);
      field = ConnectionValidator.class.getDeclaredField("pingPeriod");
      field.setAccessible(true);
      long pingPeriod = ((Long) field.get(validator)).longValue();
      assertEquals(3456, pingPeriod);
     
View Full Code Here

      client.addConnectionListener(listener, metadata);
     
      // Test pingPeriod.
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
      ConnectionValidator validator = (ConnectionValidator) field.get(client);
      field = ConnectionValidator.class.getDeclaredField("pingPeriod");
      field.setAccessible(true);
      long pingPeriod = ((Long) field.get(validator)).longValue();
      assertEquals(3468, pingPeriod);
     
View Full Code Here

      client.addConnectionListener(listener, metadata);
     
      // Test pingPeriod.
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
      ConnectionValidator validator = (ConnectionValidator) field.get(client);
      field = ConnectionValidator.class.getDeclaredField("pingPeriod");
      field.setAccessible(true);
      long pingPeriod = ((Long) field.get(validator)).longValue();
      assertEquals(3467, pingPeriod);
     
View Full Code Here

      client.addConnectionListener(listener, metadata);
     
      // Test pingPeriod.
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
      ConnectionValidator validator = (ConnectionValidator) field.get(client);
      field = ConnectionValidator.class.getDeclaredField("pingPeriod");
      field.setAccessible(true);
      long pingPeriod = ((Long) field.get(validator)).longValue();
      assertEquals(3414, pingPeriod);
     
View Full Code Here

      client.addConnectionListener(listener, metadata);
     
      // Test pingPeriod.
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
      ConnectionValidator validator = (ConnectionValidator) field.get(client);
      field = ConnectionValidator.class.getDeclaredField("pingPeriod");
      field.setAccessible(true);
      long pingPeriod = ((Long) field.get(validator)).longValue();
      assertEquals(ConnectionValidator.DEFAULT_PING_PERIOD, pingPeriod);
     
View Full Code Here

TOP

Related Classes of org.jboss.remoting.ConnectionValidator$ConnectionCheckThread

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.