Package org.jboss.remoting.transport

Examples of org.jboss.remoting.transport.Connector


      serverLocator = new InvokerLocator(locatorURI);
      log.info("Starting remoting server with locator uri of: " + locatorURI);
      HashMap config = new HashMap();
      config.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraServerConfig(config);
      connector = new Connector(serverLocator, config);
      connector.create();
      invocationHandler = new SampleInvocationHandler();
      connector.addInvocationHandler("sample", invocationHandler);
      connector.start();
     
View Full Code Here


      serverLocator = new InvokerLocator(locatorURI);
      log.info("Starting remoting server with locator uri of: " + locatorURI);
      HashMap config = new HashMap();
      config.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraServerConfig(config);
      connector = new Connector(serverLocator, config);
      connector.create();
      invocationHandler = new SampleInvocationHandler();
      connector.addInvocationHandler("sample", invocationHandler);
      connector.start();
     
View Full Code Here

      serverLocator = new InvokerLocator(locatorURI);
      log.info("Starting remoting server with locator uri of: " + locatorURI);
      HashMap config = new HashMap();
      config.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraServerConfig(config);
      connector = new Connector(serverLocator, config);
      connector.create();
      invocationHandler = new TestInvocationHandler();
      connector.addInvocationHandler("test", invocationHandler);
      connector.start();
   }
View Full Code Here

      serverLocator = new InvokerLocator(locatorURI);
      log.info("Starting remoting server with locator uri of: " + locatorURI);
      HashMap config = new HashMap();
      config.put(InvokerLocator.FORCE_REMOTE, "true");
      config.put("leasePeriod", "1000");
      connector = new Connector(serverLocator, config);
      connector.create();
      invocationHandler = new TestInvocationHandler();
      connector.addInvocationHandler("test", invocationHandler);
      connector.addConnectionListener(new TestConnectionListener());
      connector.start();
View Full Code Here

      log.info("Starting remoting server with locator uri of: " + locatorURI);
      HashMap config = new HashMap();
      config.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraServerConfig(config);
      mbeanServer = MBeanServerFactory.createMBeanServer();
      connector = new Connector(serverLocator, config);
      connector.preRegister(mbeanServer, new ObjectName("remoting:service=connector"));
      connector.create();
      invocationHandler = new TestInvocationHandler();
      connector.addInvocationHandler("test", invocationHandler);
      connector.start();
View Full Code Here

      InvokerLocator serverLocator = new InvokerLocator(locatorURI);
      log.info("Starting remoting server with locator uri of: " + locatorURI);
      HashMap serverConfig = new HashMap();
      serverConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      serverConfig.put(Bisocket.IS_CALLBACK_SERVER, "false");
      Connector connector = new Connector(serverLocator, serverConfig);
      connector.create();
      SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
      connector.addInvocationHandler("sample", invocationHandler);
      connector.start();
      log.info("Started remoting server with locator uri of: " + locatorURI);
     
      HashMap clientConfig = new HashMap();
      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      clientConfig.put(Bisocket.IS_CALLBACK_SERVER, "true");
      log.info("client onnecting to: " + serverLocator);
      Client client = new Client(serverLocator, clientConfig);
      client.connect();
      log.info("client is connected");
      SampleCallbackHandler callbackHandler = new SampleCallbackHandler();
     
      long start = System.currentTimeMillis();
      for (int i = 0; i < LOOPS; i++)
      {
         client.invoke("test");
         client.addListener(callbackHandler, new HashMap(), null, true);
         client.removeListener(callbackHandler);
         assertEquals(i+1, callbackHandler.counter);
         if ((i+1) % 100 == 0)
            log.info("connections: " + (i+1));
      }
      long finish = System.currentTimeMillis();
      log.info("time to create " + LOOPS + " connections: " + (finish - start));
     
      client.disconnect();
      connector.stop();
   }
View Full Code Here

      log.info("Starting remoting server with locator uri of: " + locatorURI);
      HashMap config = new HashMap();
      config.put(InvokerLocator.FORCE_REMOTE, "true");
      config.put(ServerInvoker.TIMEOUT, "3000");
      addExtraServerConfig(config);
      connector = new Connector(serverLocator, config);
      connector.create();
      invocationHandler = new TestInvocationHandler();
      connector.addInvocationHandler("sample", invocationHandler);
      connector.start();
View Full Code Here

      HashMap config = new HashMap();
      config.put(InvokerLocator.FORCE_REMOTE, "true");
      config.put(Bisocket.PING_FREQUENCY, TEST_PING_FREQUENCY_STRING);
      config.put(MicroSocketClientInvoker.MAX_POOL_SIZE_FLAG, TEST_MAX_POOL_SIZE_STRING);
      addExtraServerConfig(config);
      connector = new Connector(serverLocator, config);
      connector.create();
      invocationHandler = new SampleInvocationHandler();
      connector.addInvocationHandler("sample", invocationHandler);
     
      for (int i = 0; i < 5; i++)
View Full Code Here

      HashMap serverConfig = new HashMap();
      serverConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      serverConfig.put(Bisocket.PING_FREQUENCY, TEST_PING_FREQUENCY_STRING);
      serverConfig.put(Bisocket.MAX_RETRIES, TEST_MAX_RETRIES_STRING);
      addExtraServerConfig(serverConfig);
      connector = new Connector(serverLocator, serverConfig);
      connector.create();
      invocationHandler = new SampleInvocationHandler();
      connector.addInvocationHandler("sample", invocationHandler);
      connector.start();
     
      HashMap clientConfig = new HashMap();
      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      clientConfig.put(Bisocket.IS_CALLBACK_SERVER, "true");
      clientConfig.put(Bisocket.PING_FREQUENCY, TEST_PING_FREQUENCY_STRING);
      clientConfig.put(Bisocket.PING_WINDOW_FACTOR, TEST_PING_WINDOW_FACTOR_STRING);
      clientConfig.put(Bisocket.MAX_RETRIES, TEST_MAX_RETRIES_STRING);
      clientConfig.put(Bisocket.MAX_CONTROL_CONNECTION_RESTARTS, TEST_CONTROL_CONNECTION_RESTARTS_STRING);

      addExtraClientConfig(clientConfig);
      Client client = new Client(serverLocator, clientConfig);
      client.connect();
      log.info("client is connected");
     
      SimpleCallbackHandler callbackHandler = new SimpleCallbackHandler();
      client.addListener(callbackHandler, new HashMap());
      log.info("client added callback handler");
     
      Integer count = new Integer(17);
      HashMap metadata = new HashMap();
      metadata.put(COUNTER, count);
      Integer response = (Integer) client.invoke(INVOCATION_TEST, metadata);
      assertEquals(17, response.intValue());
     
      // Test server invoker configuration.
      // Actually, none of these parameters are used by the server invoker.
     
      // Test callback client invoker configuration.
      Set callbackHandlers = invocationHandler.callbackHandlers;
      assertEquals(1, callbackHandlers.size());
      ServerInvokerCallbackHandler sich = (ServerInvokerCallbackHandler) callbackHandlers.iterator().next();
      Client callbackClient = sich.getCallbackClient();
      assertTrue(callbackClient.getInvoker() instanceof BisocketClientInvoker);
      BisocketClientInvoker callbackClientInvoker = (BisocketClientInvoker) callbackClient.getInvoker();
      assertEquals(TEST_PING_FREQUENCY, callbackClientInvoker.getPingFrequency());
      assertEquals(TEST_MAX_RETRIES, callbackClientInvoker.getMaxRetries());

      // Test client invoker configuration.
      assertTrue(client.getInvoker() instanceof BisocketClientInvoker);
      BisocketClientInvoker clientInvoker = (BisocketClientInvoker) client.getInvoker();
      assertEquals(TEST_PING_FREQUENCY, clientInvoker.getPingFrequency());
      assertEquals(TEST_MAX_RETRIES, clientInvoker.getMaxRetries());
     
      // Test callback server invoker configuration.
      Field field = Client.class.getDeclaredField("callbackConnectors");
      field.setAccessible(true);
      Map callbackConnectorsMap = (Map) field.get(client);
      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();
View Full Code Here

      String host = InetAddress.getLocalHost().getHostAddress();
      int port = PortUtil.findFreePort(host);
      HashMap serverConfig = new HashMap();
      serverConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraServerConfig(serverConfig);
      connector = new Connector(serverConfig);
     
      StringBuffer buf = new StringBuffer();
      buf.append("<?xml version=\"1.0\"?>\n");
      buf.append("<config>");
      buf.append("   <invoker transport=\"" + getTransport() + "\">");
      buf.append("      <attribute name=\"serverBindAddress\">" + host + "</attribute>");
      buf.append("      <attribute name=\"serverBindPort\">" + port + "</attribute>");
      buf.append("      <attribute name=\"pingFrequency\" isParam=\"true\">" + TEST_PING_FREQUENCY_STRING + "</attribute>");
      buf.append("      <attribute name=\"pingWindowFactor\" isParam=\"true\">" + TEST_PING_WINDOW_FACTOR_STRING + "</attribute>");
      buf.append("      <attribute name=\"maxRetries\" isParam=\"true\">" + TEST_MAX_RETRIES_STRING + "</attribute>");
      buf.append("      <attribute name=\"maxControlConnectionRestarts\" isParam=\"true\">" + TEST_CONTROL_CONNECTION_RESTARTS_STRING + "</attribute>");
      buf.append("   </invoker>");
      buf.append("</config>");
      log.info(buf);
      ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
      Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
      connector.setConfiguration(xml.getDocumentElement());
      connector.create();
      invocationHandler = new SampleInvocationHandler();
      connector.addInvocationHandler("sample", invocationHandler);
      connector.start();
      InvokerLocator serverLocator = connector.getLocator();
      System.out.println("started connector with locator uri of: " + serverLocator);
     
      HashMap clientConfig = new HashMap();
      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      clientConfig.put(Bisocket.IS_CALLBACK_SERVER, "true");
      addExtraClientConfig(clientConfig);
      Client client = new Client(serverLocator, clientConfig);
      client.connect();
      log.info("client is connected");
     
      SimpleCallbackHandler callbackHandler = new SimpleCallbackHandler();
      client.addListener(callbackHandler, new HashMap());
      log.info("client added callback handler");
     
      Integer count = new Integer(17);
      HashMap metadata = new HashMap();
      metadata.put(COUNTER, count);
      Integer response = (Integer) client.invoke(INVOCATION_TEST, metadata);
      assertEquals(17, response.intValue());
     
      // Test server invoker configuration.
      // Actually, none of these parameters are used by the server invoker.
        
      // Test callback client invoker configuration.
      Set callbackHandlers = invocationHandler.callbackHandlers;
      assertEquals(1, callbackHandlers.size());
      ServerInvokerCallbackHandler sich = (ServerInvokerCallbackHandler) callbackHandlers.iterator().next();
      Client callbackClient = sich.getCallbackClient();
      assertTrue(callbackClient.getInvoker() instanceof BisocketClientInvoker);
      BisocketClientInvoker callbackClientInvoker = (BisocketClientInvoker) callbackClient.getInvoker();
      assertEquals(TEST_PING_FREQUENCY, callbackClientInvoker.getPingFrequency());
      assertEquals(TEST_MAX_RETRIES, callbackClientInvoker.getMaxRetries());
      // Test client invoker configuration.
      assertTrue(client.getInvoker() instanceof BisocketClientInvoker);
      BisocketClientInvoker clientInvoker = (BisocketClientInvoker) client.getInvoker();
      assertEquals(TEST_PING_FREQUENCY, clientInvoker.getPingFrequency());
      assertEquals(TEST_MAX_RETRIES, clientInvoker.getMaxRetries());
     
      // Test callback server invoker configuration.
      Field field = Client.class.getDeclaredField("callbackConnectors");
      field.setAccessible(true);
      Map callbackConnectorsMap = (Map) field.get(client);
      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();
View Full Code Here

TOP

Related Classes of org.jboss.remoting.transport.Connector

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.