Package org.jboss.remoting

Examples of org.jboss.remoting.ServerConfiguration


      log.info("entering " + getName());
     
      // Start server.
      host = InetAddress.getLocalHost().getHostAddress();
      port = PortUtil.findFreePort(host);
      ServerConfiguration config = new ServerConfiguration("http");
      Map locatorConfig = new HashMap();
      locatorConfig.put("serverBindAddress", host);
      locatorConfig.put("serverBindPort", Integer.toString(port));
      locatorConfig.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true");
      locatorConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      config.setInvokerLocatorParameters(locatorConfig);
      Map handlers = new HashMap();
      handlers.put("test", new TestInvocationHandler());
      config.setInvocationHandlers(handlers);
      connector = new Connector();
      connector.setServerConfiguration(config);
      connector.create();
      connector.start();
     
View Full Code Here


   public void testConfiguration() throws Throwable
  
      log.info("entering " + getName());
     
      // Create ServerConfiguration
      ServerConfiguration config = new ServerConfiguration("socket");
      Map locatorConfig = new HashMap();
     
      // Add invokerLocatorParameters
      String address = InetAddress.getLocalHost().getHostAddress();
      locatorConfig.put("serverBindAddress", address);
      locatorConfig.put("serverBindPort", "4446");
      locatorConfig.put("datatype", "test");
      locatorConfig.put("timeout", "12345");
      config.setInvokerLocatorParameters(locatorConfig);
     
      // Add serverParameters
      Map serverParameters = new HashMap();
      serverParameters.put("clientLeasePeriod", "2345");
      serverParameters.put("timeout", "54321");
      ServerSocketFactory factory = new TestServerSocketFactory();
      serverParameters.put("customServerSocketFactory", factory);
      config.setServerParameters(serverParameters);
     
      // Add invocation handlers
      Map handlers = new HashMap();
      handlers.put("system1", "org.jboss.test.remoting.transport.config.TestServerInvocationHandler1");
      ServerInvocationHandler handler2 = new TestServerInvocationHandler2();
      handlers.put("system2,system3", handler2);
      config.setInvocationHandlers(handlers);
     
      log.info("invokerLocatorParameters: " + config.getInvokerLocatorParameters());
      log.info("serverParameters: " + config.getServerParameters());
      log.info("invocationHandlers: " + config.getInvocationHandlers());
     
      // Create Connector and get ServerInvoker
      // Get ServerInvoker.
      connector = new Connector();
      connector.setServerConfiguration(config);
View Full Code Here

   public void testClientConnectParameters() throws Throwable
  
      log.info("entering " + getName());
     
      // Create ServerConfiguration
      ServerConfiguration config = new ServerConfiguration("socket");
      Map locatorConfig = new HashMap();
     
      // Add invokerLocatorParameters
      String serverBindAddress = "localhost";
      String serverBindPort = "4446";
      String clientConnectAddress = InetAddress.getLocalHost().getHostAddress();
      String clientConnectPort = "4447";
      locatorConfig.put("serverBindAddress", serverBindAddress);
      locatorConfig.put("serverBindPort", serverBindPort);
      locatorConfig.put("clientConnectAddress", clientConnectAddress);
      locatorConfig.put("clientConnectPort", clientConnectPort);
      config.setInvokerLocatorParameters(locatorConfig);
     
      log.info("invokerLocatorParameters: " + config.getInvokerLocatorParameters());
      log.info("serverParameters: " + config.getServerParameters());
      log.info("invocationHandlers: " + config.getInvocationHandlers());
     
      // Create Connector and get ServerInvoker
      // Get ServerInvoker.
      connector = new Connector();
      connector.setServerConfiguration(config);
View Full Code Here

   public void testSingleHomeParametersInBothParametersMaps() throws Throwable
  
      log.info("entering " + getName());
     
      // Create ServerConfiguration
      ServerConfiguration config = new ServerConfiguration("socket");
      Map locatorConfig = new HashMap();
      Map serverConfig = new HashMap();
     
      // Add invokerLocatorParameters
      String serverBindAddress1 = InetAddress.getLocalHost().getHostName();
      String serverBindPort1 = "4446";
      String clientConnectAddress1 = InetAddress.getLocalHost().getHostAddress();
      String clientConnectPort1 = "4447";
      locatorConfig.put("serverBindAddress", serverBindAddress1);
      locatorConfig.put("serverBindPort", serverBindPort1);
      locatorConfig.put("clientConnectAddress", clientConnectAddress1);
      locatorConfig.put("clientConnectPort", clientConnectPort1);
      config.setInvokerLocatorParameters(locatorConfig);
     
      // Add serverParameters
      String serverBindAddress2 = InetAddress.getLocalHost().getHostAddress();
      String serverBindPort2 = "4448";
      String clientConnectAddress2 = InetAddress.getLocalHost().getHostName();
      String clientConnectPort2 = "4447";
      serverConfig.put("serverBindAddress", serverBindAddress2);
      serverConfig.put("serverBindPort", serverBindPort2);
      serverConfig.put("clientConnectAddress", clientConnectAddress2);
      serverConfig.put("clientConnectPort", clientConnectPort2);
      config.setServerParameters(serverConfig);
     
      log.info("invokerLocatorParameters: " + config.getInvokerLocatorParameters());
      log.info("serverParameters: " + config.getServerParameters());
      log.info("invocationHandlers: " + config.getInvocationHandlers());
     
      // Create Connector and get ServerInvoker
      // Get ServerInvoker.
      connector = new Connector();
      connector.setServerConfiguration(config);
View Full Code Here

   public void testMultihomeWithPortsNoDefault() throws Throwable
  
      log.info("entering " + getName());
     
      // Create ServerConfiguration
      ServerConfiguration config = new ServerConfiguration("socket");
      Map locatorConfig = new HashMap();
     
      // Add non-multihome invokerLocatorParameters - show they don't interfere.
      String serverBindAddress = "localhost";
      String serverBindPort = "4446";
      String clientConnectAddress = InetAddress.getLocalHost().getHostAddress();
      String clientConnectPort = "4447";
      locatorConfig.put("serverBindAddress", serverBindAddress);
      locatorConfig.put("serverBindPort", serverBindPort);
      locatorConfig.put("clientConnectAddress", clientConnectAddress);
      locatorConfig.put("clientConnectPort", clientConnectPort);
     
      // Add multihome invokerLocatorParameters.
      ArrayList homes = new ArrayList();
      Enumeration e1 = NetworkInterface.getNetworkInterfaces();
      loop: while (e1.hasMoreElements())
      {
         NetworkInterface ni = (NetworkInterface) e1.nextElement();
         Enumeration e2 = ni.getInetAddresses();
         while (e2.hasMoreElements())
         {
            InetAddress ia = (InetAddress) e2.nextElement();
            Home h = new Home(ia.getHostAddress(), 3333);
            homes.add(h);
            if (homes.size() >= MAX_HOMES)
               break loop;
         }
      }
     
      Home h = (Home) homes.get(0);
      StringBuffer sb = new StringBuffer(h.host).append(':').append(h.port);
      for (int i = 1; i < homes.size(); i++)
      {
         h = (Home) homes.get(i);
         sb.append('!').append(h.host).append(':').append(h.port);
      }

      locatorConfig.put(InvokerLocator.HOMES_KEY, sb.toString());
      locatorConfig.put(InvokerLocator.CONNECT_HOMES_KEY, sb.toString());
      config.setInvokerLocatorParameters(locatorConfig);
     
      log.info("invokerLocatorParameters: " + config.getInvokerLocatorParameters());
      log.info("serverParameters: " + config.getServerParameters());
      log.info("invocationHandlers: " + config.getInvocationHandlers());
     
      // Create Connector.
      connector = new Connector();
      connector.setServerConfiguration(config);
      connector.create();
View Full Code Here

   public void testMultihomeNoPortsWithDefaultPort() throws Throwable
  
      log.info("entering " + getName());
     
      // Create ServerConfiguration
      ServerConfiguration config = new ServerConfiguration("socket");
      Map locatorConfig = new HashMap();
     
      // Add non-multihome invokerLocatorParameters - show they don't interfere.
      String serverBindAddress = "localhost";
      String serverBindPort = "4446";
      String clientConnectAddress = InetAddress.getLocalHost().getHostAddress();
      String clientConnectPort = "4447";
      locatorConfig.put("serverBindAddress", serverBindAddress);
      locatorConfig.put("serverBindPort", serverBindPort);
      locatorConfig.put("clientConnectAddress", clientConnectAddress);
      locatorConfig.put("clientConnectPort", clientConnectPort);
     
      // Add multihome invokerLocatorParameters.
      ArrayList homes = new ArrayList();
      Enumeration e1 = NetworkInterface.getNetworkInterfaces();
      loop: while (e1.hasMoreElements())
      {
         NetworkInterface ni = (NetworkInterface) e1.nextElement();
         Enumeration e2 = ni.getInetAddresses();
         while (e2.hasMoreElements())
         {
            InetAddress ia = (InetAddress) e2.nextElement();
            String host = ia.getHostAddress();
            boolean isIPv6 = host.indexOf('[') >= 0 || host.indexOf(':') >= 0;
            if (isIPv6) host = '[' + host + ']';
            Home h = new Home(host, -1);
            homes.add(h);
            if (homes.size() >= MAX_HOMES)
               break loop;
         }
      }
     
      Home h = (Home) homes.get(0);
      StringBuffer sb = new StringBuffer(h.host);
      for (int i = 1; i < homes.size(); i++)
      {
         h = (Home) homes.get(i);
         sb.append('!').append(h.host);
      }

      locatorConfig.put(InvokerLocator.CONNECT_HOMES_KEY, sb.toString());
      locatorConfig.put(InvokerLocator.HOMES_KEY, sb.toString());
      locatorConfig.put(InvokerLocator.DEFAULT_CONNECT_PORT, "3333");
      locatorConfig.put(InvokerLocator.DEFAULT_PORT, "4444");
      config.setInvokerLocatorParameters(locatorConfig);
     
      log.info("invokerLocatorParameters: " + config.getInvokerLocatorParameters());
      log.info("serverParameters: " + config.getServerParameters());
      log.info("invocationHandlers: " + config.getInvocationHandlers());
     
      // Create Connector.
      connector = new Connector();
      connector.setServerConfiguration(config);
      connector.create();
View Full Code Here

   public void testMultihomeDuplicateElements() throws Throwable
  
      log.info("entering " + getName());
     
      // Create ServerConfiguration
      ServerConfiguration config = new ServerConfiguration("socket");
      Map locatorConfig = new HashMap();
      Map serverConfig = new HashMap();
     
      // Add multihome invokerLocatorParameters.
      ArrayList homes = new ArrayList();
      Enumeration e1 = NetworkInterface.getNetworkInterfaces();
      loop: while (e1.hasMoreElements())
      {
         NetworkInterface ni = (NetworkInterface) e1.nextElement();
         Enumeration e2 = ni.getInetAddresses();
         while (e2.hasMoreElements())
         {
            InetAddress ia = (InetAddress) e2.nextElement();
            Home h = new Home(ia.getHostAddress(), -1);
            homes.add(h);
            if (homes.size() >= MAX_HOMES)
               break loop;
         }
      }
     
      Home h = (Home) homes.get(0);
      StringBuffer sb1 = new StringBuffer(h.host).append(':').append("1111");
      for (int i = 1; i < homes.size(); i++)
      {
         h = (Home) homes.get(i);
         sb1.append('!').append(h.host).append(":").append("1111");
      }
      locatorConfig.put(InvokerLocator.CONNECT_HOMES_KEY, sb1.toString());
     
      h = (Home) homes.get(0);
      StringBuffer sb2 = new StringBuffer(h.host).append(':').append("2222");
      for (int i = 1; i < homes.size(); i++)
      {
         h = (Home) homes.get(i);
         sb2.append('!').append(h.host).append(":").append("2222");
      }
      serverConfig.put(InvokerLocator.CONNECT_HOMES_KEY, sb2.toString());
     
      h = (Home) homes.get(0);
      StringBuffer sb3 = new StringBuffer(h.host).append(':').append("3333");
      for (int i = 1; i < homes.size(); i++)
      {
         h = (Home) homes.get(i);
         sb3.append('!').append(h.host).append(":").append("3333");
      }
      locatorConfig.put(InvokerLocator.HOMES_KEY, sb3.toString());
     
      h = (Home) homes.get(0);
      StringBuffer sb4 = new StringBuffer(h.host).append(':').append("4444");
      for (int i = 1; i < homes.size(); i++)
      {
         h = (Home) homes.get(i);
         sb4.append('!').append(h.host).append(":").append("4444");
      }
      serverConfig.put(InvokerLocator.HOMES_KEY, sb4.toString());
     
      config.setInvokerLocatorParameters(locatorConfig);
      config.setServerParameters(serverConfig);
     
      log.info("invokerLocatorParameters: " + config.getInvokerLocatorParameters());
      log.info("serverParameters: " + config.getServerParameters());
      log.info("invocationHandlers: " + config.getInvocationHandlers());
     
      // Create Connector.
      connector = new Connector();
      connector.setServerConfiguration(config);
      connector.create();
View Full Code Here

   public void testMultihomeHomesInServerConfig() throws Throwable
  
      log.info("entering " + getName());
     
      // Create ServerConfiguration
      ServerConfiguration config = new ServerConfiguration("socket");
      Map locatorConfig = new HashMap();
      Map serverConfig = new HashMap();
     
      // Add multihome invokerLocatorParameters.
      ArrayList homes = new ArrayList();
      Enumeration e1 = NetworkInterface.getNetworkInterfaces();
      loop: while (e1.hasMoreElements())
      {
         NetworkInterface ni = (NetworkInterface) e1.nextElement();
         Enumeration e2 = ni.getInetAddresses();
         while (e2.hasMoreElements())
         {
            InetAddress ia = (InetAddress) e2.nextElement();
            Home h = new Home(ia.getHostAddress(), -1);
            homes.add(h);
            if (homes.size() >= MAX_HOMES)
               break loop;
         }
      }
     
      Home h = (Home) homes.get(0);
      StringBuffer sb4 = new StringBuffer(h.host).append(':').append("4444");
      for (int i = 1; i < homes.size(); i++)
      {
         h = (Home) homes.get(i);
         sb4.append('!').append(h.host).append(":").append("4444");
      }
      serverConfig.put(InvokerLocator.HOMES_KEY, sb4.toString());
     
      config.setInvokerLocatorParameters(locatorConfig);
      config.setServerParameters(serverConfig);
     
      log.info("invokerLocatorParameters: " + config.getInvokerLocatorParameters());
      log.info("serverParameters: " + config.getServerParameters());
      log.info("invocationHandlers: " + config.getInvocationHandlers());
     
      // Create Connector.
      connector = new Connector();
      connector.setServerConfiguration(config);
      connector.create();
View Full Code Here

   public void testMultihomeMissingHomes() throws Throwable
  
      log.info("entering " + getName());
     
      // Create ServerConfiguration
      ServerConfiguration config = new ServerConfiguration("socket");
      Map locatorConfig = new HashMap();
      Map serverConfig = new HashMap();
     
      // Add multihome invokerLocatorParameters.
      ArrayList homes = new ArrayList();
      Enumeration e1 = NetworkInterface.getNetworkInterfaces();
      loop: while (e1.hasMoreElements())
      {
         NetworkInterface ni = (NetworkInterface) e1.nextElement();
         Enumeration e2 = ni.getInetAddresses();
         while (e2.hasMoreElements())
         {
            InetAddress ia = (InetAddress) e2.nextElement();
            Home h = new Home(ia.getHostAddress(), -1);
            homes.add(h);
            if (homes.size() >= MAX_HOMES)
               break loop;
         }
      }
     
      Home h = (Home) homes.get(0);
      StringBuffer sb1 = new StringBuffer(h.host).append(':').append("1111");
      for (int i = 1; i < homes.size(); i++)
      {
         h = (Home) homes.get(i);
         sb1.append('!').append(h.host).append(":").append("1111");
      }
      locatorConfig.put(InvokerLocator.CONNECT_HOMES_KEY, sb1.toString());
     
      config.setInvokerLocatorParameters(locatorConfig);
      config.setServerParameters(serverConfig);
     
      log.info("invokerLocatorParameters: " + config.getInvokerLocatorParameters());
      log.info("serverParameters: " + config.getServerParameters());
      log.info("invocationHandlers: " + config.getInvocationHandlers());
     
      // Create Connector.
      connector = new Connector();
      connector.setServerConfiguration(config);
     
View Full Code Here

   public void testMultihomeAnonymousPorts() throws Throwable
  
      log.info("entering " + getName());
     
      // Create ServerConfiguration
      ServerConfiguration config = new ServerConfiguration("socket");
      Map locatorConfig = new HashMap();
     
      // Add non-multihome invokerLocatorParameters - show they don't interfere.
      String serverBindAddress = "localhost";
      String serverBindPort = "4446";
      String clientConnectAddress = InetAddress.getLocalHost().getHostAddress();
      String clientConnectPort = "4447";
      locatorConfig.put("serverBindAddress", serverBindAddress);
      locatorConfig.put("serverBindPort", serverBindPort);
      locatorConfig.put("clientConnectAddress", clientConnectAddress);
      locatorConfig.put("clientConnectPort", clientConnectPort);
     
      // Add multihome invokerLocatorParameters.
      ArrayList homes = new ArrayList();
      Enumeration e1 = NetworkInterface.getNetworkInterfaces();
      loop: while (e1.hasMoreElements())
      {
         NetworkInterface ni = (NetworkInterface) e1.nextElement();
         Enumeration e2 = ni.getInetAddresses();
         log.info("interface: " + ni.getDisplayName());
         while (e2.hasMoreElements())
         {
            InetAddress ia = (InetAddress) e2.nextElement();
            String host = ia.getHostAddress();
            boolean isIPv6 = host.indexOf('[') >= 0 || host.indexOf(':') >= 0;
            if (isIPv6) host = '[' + host + ']';
            log.info("host: " + host);
            Home h = new Home(host, -1);
            homes.add(h);
            if (homes.size() >= MAX_HOMES)
               break loop;
         }
      }
     
      Home h = (Home) homes.get(0);
      StringBuffer sb = new StringBuffer(h.host);
      for (int i = 1; i < homes.size(); i++)
      {
         h = (Home) homes.get(i);
         sb.append('!').append(h.host);
      }

      locatorConfig.put(InvokerLocator.CONNECT_HOMES_KEY, sb.toString());
      locatorConfig.put(InvokerLocator.HOMES_KEY, sb.toString());
      config.setInvokerLocatorParameters(locatorConfig);
     
      log.info("invokerLocatorParameters: " + config.getInvokerLocatorParameters());
      log.info("serverParameters: " + config.getServerParameters());
      log.info("invocationHandlers: " + config.getInvocationHandlers());
     
      // Create Connector.
      connector = new Connector();
      connector.setServerConfiguration(config);
      connector.create();
View Full Code Here

TOP

Related Classes of org.jboss.remoting.ServerConfiguration

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.