[jboss-remoting-commits] JBoss Remoting SVN: r4137 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting: security and 1 other directory.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed May 7 19:42:08 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-05-07 19:42:08 -0400 (Wed, 07 May 2008)
New Revision: 4137

Added:
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/CallbackErrorHandlerProxyTestCase.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/CallbackStoreProxyTestCase.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/NetworkRegistryProxyTestCase.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/ServerInvokerHandlerProxyTestCase.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/ServerSocketFactoryProxyTestCase.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackErrorHandler.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackErrorHandlerMBean.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackStore.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackStoreMBean.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestNetworkRegistry.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestNetworkRegistryMBean.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerInvocationHandler.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerInvocationHandlerMBean.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerSocketFactory.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerSocketFactoryMBean.java
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/keystore
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/truststore
Log:
JBREM-977: New unit tests.

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/CallbackErrorHandlerProxyTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/CallbackErrorHandlerProxyTestCase.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/CallbackErrorHandlerProxyTestCase.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,236 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * 
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 4, 2008
+ * </p>
+ */
+public class CallbackErrorHandlerProxyTestCase extends TestCase
+{
+   private static Logger log = Logger.getLogger(CallbackErrorHandlerProxyTestCase.class);
+   
+   private static boolean firstTime = true;
+   protected String host;
+   protected int port;
+   protected String locatorURI;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected TestCallbackErrorHandler errorHandler;
+   protected MBeanServer server;
+   protected ObjectName errorHandlerObjectName;
+
+   
+   public void setUp() throws Exception
+   {
+      if (firstTime)
+      {
+         firstTime = false;
+         Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+         Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+         String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+         PatternLayout layout = new PatternLayout(pattern);
+         ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+         Logger.getRootLogger().addAppender(consoleAppender);  
+      }
+   }
+
+   
+   public void tearDown()
+   {
+   }
+   
+   
+   public void testCallbackStoreProxy() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer();
+      log.info("ServerInvocationHandler: " + errorHandler);
+      
+      // Create client.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      addExtraClientConfig(clientConfig);
+      Client client = new Client(clientLocator, clientConfig);
+      client.connect();
+      log.info("client is connected");
+      
+      // Check connection.
+      assertEquals("abc", client.invoke("abc"));
+      log.info("connection is good");
+      
+      // Verify callbacks work.
+      TestCallbackHandler callbackHandler = new TestCallbackHandler();
+      client.addListener(callbackHandler, null, null, true);
+      assertEquals(1, callbackHandler.counter);
+      
+      // Verify CallbackErrorHandler proxy gets used.
+      client.addListener(callbackHandler, null, null, true);
+      assertEquals(1, callbackHandler.counter);
+      assertEquals(1, errorHandler.counter);
+      int counter = ((Integer) server.getAttribute(errorHandlerObjectName, "Counter")).intValue();
+      assertEquals(errorHandler.counter, counter);
+
+      client.disconnect();
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "socket";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   protected void addExtraServerConfig(Map config) {}
+   
+
+   protected void setupServer() throws Exception
+   {
+      host = InetAddress.getLocalHost().getHostAddress();
+      port = PortUtil.findFreePort(host);
+      locatorURI = getTransport() + "://" + host + ":" + port; 
+      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);
+      
+      // Create CallbackErrorHandler.
+      server = MBeanServerFactory.createMBeanServer();
+      errorHandler = new TestCallbackErrorHandler();
+      String objectNameString = "test:type=TestCallbackErrorHandler";
+      errorHandlerObjectName = new ObjectName(objectNameString);
+      server.registerMBean(errorHandler, errorHandlerObjectName);
+      config.put(ServerInvokerCallbackHandler.CALLBACK_ERROR_HANDLER_KEY, objectNameString);
+      
+      // Create Connector..
+      connector = new Connector(serverLocator, config);
+      server.registerMBean(connector, new ObjectName("test:type=Connector"));
+      connector.create();
+      connector.addInvocationHandler("test", new TestServerInvocationHandler());
+      connector.start();
+   }
+   
+   
+   protected void shutdownServer() throws Exception
+   {
+      if (connector != null)
+         connector.stop();
+   }
+   
+   
+   public static class TestServerInvocationHandler implements ServerInvocationHandler
+   {
+      static Logger log = Logger.getLogger(TestServerInvocationHandler.class);
+      private int counter;
+      
+      public void addListener(InvokerCallbackHandler callbackHandler)
+      {
+         try
+         {
+            if (counter++ == 0)
+            {
+               // First time, send callback.
+               callbackHandler.handleCallback(new Callback("callback"));
+            }
+            else
+            {
+               // Next, generate callback exception.
+               callbackHandler.handleCallback(new Callback(new NotSerializable()));
+            }
+         }
+         catch (HandleCallbackException e)
+         {
+            if (counter == 0)
+               log.error("Unexpected exception", e);
+            else
+               log.info("Expected exception: " + e.getMessage());
+         }
+      }
+
+      public Object invoke(final InvocationRequest invocation) throws Throwable
+      {
+         return invocation.getParameter();
+      }
+      
+      public void removeListener(InvokerCallbackHandler callbackHandler) {}
+      public void setMBeanServer(MBeanServer server) {}
+      public void setInvoker(ServerInvoker invoker) {}
+      
+      public int getCounter()
+      {
+         return counter;
+      }
+   }
+   
+   
+   static class TestCallbackHandler implements InvokerCallbackHandler
+   {
+      int counter;
+      
+      public void handleCallback(Callback callback) throws HandleCallbackException
+      {
+         counter++;
+         log.info("received callback");
+      }  
+   }
+   
+   static class NotSerializable {}
+}
\ No newline at end of file

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/CallbackStoreProxyTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/CallbackStoreProxyTestCase.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/CallbackStoreProxyTestCase.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,288 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * 
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 4, 2008
+ * </p>
+ */
+public class CallbackStoreProxyTestCase extends TestCase
+{
+   private static Logger log = Logger.getLogger(CallbackStoreProxyTestCase.class);
+   
+   private static boolean firstTime = true;
+   private static boolean done;
+   
+   protected String host;
+   protected int port;
+   protected String locatorURI;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected TestInvocationHandler invocationHandler;
+   protected TestCallbackStore callbackStore;
+   protected MBeanServer server;
+   protected ObjectName callbackStoreObjectName;
+
+   
+   public void setUp() throws Exception
+   {
+      if (firstTime)
+      {
+         firstTime = false;
+         Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+         Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+         String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+         PatternLayout layout = new PatternLayout(pattern);
+         ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+         Logger.getRootLogger().addAppender(consoleAppender);  
+      }
+   }
+
+   
+   public void tearDown()
+   {
+   }
+   
+   
+   public void testCallbackStoreProxy() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer();
+      
+      // Create client.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      addExtraClientConfig(clientConfig);
+      Client client = new Client(clientLocator, clientConfig);
+      client.connect();
+      log.info("client is connected");
+      
+      // Test connections.
+      assertEquals("abc", client.invoke("abc"));
+      log.info("connection is good");
+      
+      // Setup pull callbacks.
+      TestCallbackHandler callbackHandler = new TestCallbackHandler();
+      client.addListener(callbackHandler);
+      
+      if (!done)
+      {
+         synchronized (CallbackStoreProxyTestCase.class)
+         {
+            long start = System.currentTimeMillis();
+            while (true)
+            {
+               try
+               {
+                  log.info("testCallbackStoreProxy() waiting for notification");
+                  CallbackStoreProxyTestCase.class.wait(60000 - (System.currentTimeMillis() - start));
+                  log.info("testCallbackStoreProxy() received notification");
+                  break;
+               }
+               catch (InterruptedException e)
+               {
+                  log.info("interrupted", e);
+               }
+            }
+         }
+      }
+
+      // Verify TestCallbackStore got one callback.
+//      assertEquals(1, client.getCallbacks(callbackHandler).size());
+      int count = ((Integer)server.invoke(callbackStoreObjectName, "size", new Object[]{}, new String[]{})).intValue();
+      assertEquals(1, count);
+      
+      client.removeListener(callbackHandler);
+      client.disconnect();
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "socket";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   protected void addExtraServerConfig(Map config) {}
+   
+
+   protected void setupServer() throws Exception
+   {
+      host = InetAddress.getLocalHost().getHostAddress();
+      port = PortUtil.findFreePort(host);
+      locatorURI = getTransport() + "://" + host + ":" + port; 
+      serverLocator = new InvokerLocator(locatorURI);
+      log.info("Starting remoting server with locator uri of: " + locatorURI);
+      HashMap config = new HashMap();
+      config.put(InvokerLocator.FORCE_REMOTE, "true");
+      
+      // Create CallbackStore.
+      server = MBeanServerFactory.createMBeanServer();
+      TestCallbackStore callbackStore = new TestCallbackStore();
+      String objectNameString = "test:type=Callbackstore";
+      callbackStoreObjectName = new ObjectName(objectNameString);
+      server.registerMBean(callbackStore, callbackStoreObjectName);
+      config.put(ServerInvokerCallbackHandler.CALLBACK_STORE_KEY, objectNameString);
+      
+      addExtraServerConfig(config);
+      connector = new Connector(serverLocator, config);
+      server.registerMBean(connector, new ObjectName("test:type=Connector"));
+      
+      connector.create();
+      invocationHandler = new TestInvocationHandler();
+      connector.addInvocationHandler("test", invocationHandler);
+      connector.start();
+   }
+   
+   
+   protected void shutdownServer() throws Exception
+   {
+      if (connector != null)
+         connector.stop();
+   }
+   
+   
+   static class TestInvocationHandler implements ServerInvocationHandler
+   {  
+      public void addListener(InvokerCallbackHandler callbackHandler)
+      {
+         TestCallbackThread callbackThread = new TestCallbackThread(callbackHandler);
+         callbackThread.start();
+         
+         synchronized (TestCallbackStore.class)
+         {
+            long start = System.currentTimeMillis();
+            while (true)
+            {
+               try
+               {
+                  TestCallbackStore.class.wait(60000 - (System.currentTimeMillis() - start));
+                  break;
+               }
+               catch (InterruptedException e)
+               {
+                  log.info("interrupted", e);
+               }
+            }
+         }
+         
+         callbackThread.shutdown();
+         log.info("addListener() received notification");
+         done = true;
+         
+         synchronized (CallbackStoreProxyTestCase.class)
+         {
+            CallbackStoreProxyTestCase.class.notifyAll();
+         }
+      }
+      
+      public Object invoke(final InvocationRequest invocation) throws Throwable
+      {
+         return invocation.getParameter();
+      }
+      
+      public void removeListener(InvokerCallbackHandler callbackHandler) {}
+      public void setMBeanServer(MBeanServer server) {}
+      public void setInvoker(ServerInvoker invoker) {}
+   }
+   
+   
+   static class TestCallbackHandler implements InvokerCallbackHandler
+   {
+      public void handleCallback(Callback callback) throws HandleCallbackException
+      {
+         log.info("received callback");
+      }  
+   }
+   
+   static class TestCallbackThread extends Thread
+   {
+      private boolean running = true;
+      private InvokerCallbackHandler callbackHandler;
+      private Callback callback = new Callback(new byte[1000]);
+      
+      public TestCallbackThread(InvokerCallbackHandler callbackHandler)
+      {
+         this.callbackHandler = callbackHandler;
+      }
+      
+      public void shutdown()
+      {
+         running = false;
+      }
+      
+      public void run()
+      {
+         while (running)
+         {
+            try
+            {
+               callbackHandler.handleCallback(callback);
+            }
+            catch (HandleCallbackException e)
+            {
+               log.error("Error", e);
+               return;
+            }
+         }
+         log.info("shutting down");
+      }
+   }
+}
\ No newline at end of file

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/NetworkRegistryProxyTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/NetworkRegistryProxyTestCase.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/NetworkRegistryProxyTestCase.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,178 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import java.io.ByteArrayInputStream;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.detection.multicast.MulticastDetector;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.w3c.dom.Document;
+
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 4, 2008
+ * </p>
+ */
+public class NetworkRegistryProxyTestCase extends TestCase
+{
+   private static Logger log = Logger.getLogger(NetworkRegistryProxyTestCase.class);
+   
+   private static boolean firstTime = true;
+   protected String host;
+   protected int port;
+   protected String locatorURI;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected MBeanServer server;
+   protected int numAdded;
+   protected int numUpdated;
+
+   
+   public void setUp() throws Exception
+   {
+      if (firstTime)
+      {
+         firstTime = false;
+         Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+         Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+         String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+         PatternLayout layout = new PatternLayout(pattern);
+         ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+         Logger.getRootLogger().addAppender(consoleAppender);  
+      }
+   }
+
+   
+   public void tearDown()
+   {
+   }
+   
+   
+   public void testCallbackStoreProxy() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer();
+      
+      // Start registry.
+      MBeanServer server = MBeanServerFactory.createMBeanServer();
+      TestNetworkRegistry networkRegistry = new TestNetworkRegistry();
+      ObjectName name = new ObjectName("test:type=TestNetworkRegistry");
+      server.registerMBean(networkRegistry, name);
+      
+      // Create detector and tell it to register local Connectors.
+      MulticastDetector detector = new MulticastDetector();
+      StringBuffer buf = new StringBuffer();
+      buf.append("<?xml version=\"1.0\"?>\n");
+      buf.append("<local/>");
+      ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
+      Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
+      detector.setConfiguration(xml.getDocumentElement());
+      server.registerMBean(detector, new ObjectName("test:type=MulticastDetector"));
+      detector.start();
+
+      // Verify that TestNetworkRegistry proxy gets used.
+      detector.forceDetection();
+      assertEquals(1, networkRegistry.counter);
+      int counter = ((Integer) server.getAttribute(name, "Counter")).intValue();
+      assertEquals(networkRegistry.counter, counter);
+      
+      detector.stop();
+      server.unregisterMBean(name);
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "socket";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   protected void addExtraServerConfig(Map config) {}
+   
+
+   protected void setupServer() throws Exception
+   {
+      host = InetAddress.getLocalHost().getHostAddress();
+      port = PortUtil.findFreePort(host);
+      locatorURI = getTransport() + "://" + host + ":" + port; 
+      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();
+      connector.addInvocationHandler("test", new TestServerInvocationHandler());
+      connector.start();
+   }
+   
+   
+   protected void shutdownServer() throws Exception
+   {
+      if (connector != null)
+         connector.stop();
+   }
+ 
+   
+   public static class TestServerInvocationHandler implements ServerInvocationHandler
+   {  
+      public void addListener(InvokerCallbackHandler callbackHandler) {}
+
+      public Object invoke(final InvocationRequest invocation) throws Throwable
+      {
+         return invocation.getParameter();
+      }
+      
+      public void removeListener(InvokerCallbackHandler callbackHandler) {}
+      public void setMBeanServer(MBeanServer server) {}
+      public void setInvoker(ServerInvoker invoker) {}
+   }
+}
\ No newline at end of file

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/ServerInvokerHandlerProxyTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/ServerInvokerHandlerProxyTestCase.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/ServerInvokerHandlerProxyTestCase.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,160 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * 
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 4, 2008
+ * </p>
+ */
+public class ServerInvokerHandlerProxyTestCase extends TestCase
+{
+   private static Logger log = Logger.getLogger(ServerInvokerHandlerProxyTestCase.class);
+   
+   private static boolean firstTime = true;
+   protected String host;
+   protected int port;
+   protected String locatorURI;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected TestServerInvocationHandler handler;
+   protected MBeanServer server;
+   protected ObjectName handlerObjectName;
+
+   
+   public void setUp() throws Exception
+   {
+      if (firstTime)
+      {
+         firstTime = false;
+         Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+         Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+         String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+         PatternLayout layout = new PatternLayout(pattern);
+         ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+         Logger.getRootLogger().addAppender(consoleAppender);  
+      }
+   }
+
+   
+   public void tearDown()
+   {
+   }
+   
+   
+   public void testCallbackStoreProxy() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer();
+      log.info("ServerInvocationHandler: " + handler);
+      
+      // Create client.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      addExtraClientConfig(clientConfig);
+      Client client = new Client(clientLocator, clientConfig);
+      client.connect();
+      log.info("client is connected");
+      
+      // Verify handler proxy gets used.
+      assertEquals("abc", client.invoke("abc"));
+      log.info("connection is good");
+      assertEquals(1, handler.counter);
+      int counter = ((Integer) server.getAttribute(handlerObjectName, "Counter")).intValue();
+      assertEquals(handler.counter, counter);
+
+      client.disconnect();
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "socket";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   protected void addExtraServerConfig(Map config) {}
+   
+
+   protected void setupServer() throws Exception
+   {
+      host = InetAddress.getLocalHost().getHostAddress();
+      port = PortUtil.findFreePort(host);
+      locatorURI = getTransport() + "://" + host + ":" + port; 
+      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);
+      
+      // Create ServerInvocationHandler.
+      server = MBeanServerFactory.createMBeanServer();
+      handler = new TestServerInvocationHandler();
+      String objectNameString = "test:type=TestServerInvocationHandler";
+      handlerObjectName = new ObjectName(objectNameString);
+      server.registerMBean(handler, handlerObjectName);
+      
+      // Create Connector and pass in handler ObjectName.
+      connector = new Connector(serverLocator, config);
+      server.registerMBean(connector, new ObjectName("test:type=Connector"));
+      connector.create();
+      connector.addInvocationHandler("test", handlerObjectName);
+      connector.start();
+   }
+   
+   
+   protected void shutdownServer() throws Exception
+   {
+      if (connector != null)
+         connector.stop();
+   }
+}
\ No newline at end of file

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/ServerSocketFactoryProxyTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/ServerSocketFactoryProxyTestCase.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/ServerSocketFactoryProxyTestCase.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,199 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.security.SSLSocketBuilder;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.http.ssl.HTTPSClientInvoker;
+
+
+/**
+ * 
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 4, 2008
+ * </p>
+ */
+public class ServerSocketFactoryProxyTestCase extends TestCase
+{
+   private static Logger log = Logger.getLogger(ServerSocketFactoryProxyTestCase.class);
+   
+   private static boolean firstTime = true;
+   protected String host;
+   protected int port;
+   protected String locatorURI;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected MBeanServer server;
+   protected ObjectName factoryObjectName;
+   protected TestServerSocketFactory ssf;
+
+   
+   public void setUp() throws Exception
+   {
+      if (firstTime)
+      {
+         firstTime = false;
+         Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+         Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+         String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+         PatternLayout layout = new PatternLayout(pattern);
+         ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+         Logger.getRootLogger().addAppender(consoleAppender);  
+      }
+   }
+
+   
+   public void tearDown()
+   {
+   }
+   
+   
+   public void testCallbackStoreProxy() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer();
+      
+      // Create client.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      clientConfig.put(SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE, "JKS");
+      String trustStoreFilePath = this.getClass().getResource("truststore").getFile();
+      clientConfig.put(SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH, trustStoreFilePath);
+      clientConfig.put(SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD, "unit-tests-client");
+      clientConfig.put(HTTPSClientInvoker.IGNORE_HTTPS_HOST, "true");
+      addExtraClientConfig(clientConfig);
+      Client client = new Client(clientLocator, clientConfig);
+      client.connect();
+      log.info("client is connected");
+      
+      // Test connection.
+      assertEquals("abc", client.invoke("abc"));
+      log.info("connection is good");
+
+      // Verify handler proxy gets used.
+      log.info("ssf counter: " + ssf.counter);
+      assertTrue(ssf.counter > 0);
+      int counter = ((Integer) server.getAttribute(factoryObjectName, "Counter")).intValue();
+      assertEquals(ssf.counter, counter);
+      
+      client.disconnect();
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "https";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   protected void addExtraServerConfig(Map config) {}
+   
+
+   protected void setupServer() throws Exception
+   {  
+      // Set up SSLServerSocketFactory MBean.
+      HashMap sslConfig = new HashMap();
+      sslConfig.put(SSLSocketBuilder.REMOTING_KEY_STORE_TYPE, "JKS");
+      String keyStoreFilePath = getClass().getResource("keystore").getFile();
+      sslConfig.put(SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH, keyStoreFilePath);
+      sslConfig.put(SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD, "unit-tests-server");
+      sslConfig.put(SSLSocketBuilder.REMOTING_SSL_PROTOCOL, "SSL");
+      SSLSocketBuilder builder = new SSLSocketBuilder(sslConfig);
+      builder.setUseSSLServerSocketFactory(false);
+      ssf = new TestServerSocketFactory();
+      ssf.setSSLSocketBuilder(builder);
+      ssf.start();
+      server = MBeanServerFactory.createMBeanServer();
+      String objectNameString = "test:type=SSLServerSocketFactoryService";
+      factoryObjectName = new ObjectName(objectNameString);
+      server.registerMBean(ssf, factoryObjectName);
+      
+      // Create Connector.
+      host = InetAddress.getLocalHost().getHostAddress();
+      port = PortUtil.findFreePort(host);
+      locatorURI = getTransport() + "://" + host + ":" + port; 
+      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(ServerInvoker.SERVER_SOCKET_FACTORY, objectNameString);
+      addExtraServerConfig(config);
+      connector = new Connector(serverLocator, config);
+      server.registerMBean(connector, new ObjectName("test:type=Connector"));
+      connector.create();
+      TestServerInvocationHandler invocationHandler = new TestServerInvocationHandler();
+      connector.addInvocationHandler("test", invocationHandler);
+      connector.start();
+   }
+   
+   
+   protected void shutdownServer() throws Exception
+   {
+      if (connector != null)
+         connector.stop();
+   }
+   
+   
+   public static class TestServerInvocationHandler implements ServerInvocationHandler
+   {  
+      public void addListener(InvokerCallbackHandler callbackHandler) {}
+
+      public Object invoke(final InvocationRequest invocation) throws Throwable
+      {
+         return invocation.getParameter();
+      }
+      
+      public void removeListener(InvokerCallbackHandler callbackHandler) {}
+      public void setMBeanServer(MBeanServer server) {}
+      public void setInvoker(ServerInvoker invoker) {}
+   }
+}
\ No newline at end of file

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackErrorHandler.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackErrorHandler.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackErrorHandler.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,60 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 5, 2008
+ * </p>
+ */
+public class TestCallbackErrorHandler implements TestCallbackErrorHandlerMBean
+{
+   private static Logger log = Logger.getLogger(TestCallbackErrorHandler.class);
+   
+   int counter = 0;
+   
+   public void handleError(Throwable ex) throws Throwable
+   {
+      counter++;
+      log.info("handling exception: " + ex.getMessage());
+      throw ex;
+   }
+
+   public void setCallbackHandler(ServerInvokerCallbackHandler serverInvokerCallbackHandler) {}
+   public void setConfig(Map errorHandlerConfig) {}
+   public void setServerInvoker(ServerInvoker owner) {}
+   
+   public int getCounter()
+   {
+      return counter;
+   }
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackErrorHandlerMBean.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackErrorHandlerMBean.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackErrorHandlerMBean.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,38 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import org.jboss.remoting.callback.CallbackErrorHandler;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 5, 2008
+ * </p>
+ */
+public interface TestCallbackErrorHandlerMBean extends CallbackErrorHandler
+{
+   public int getCounter();
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackStore.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackStore.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackStore.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,75 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+public class TestCallbackStore implements TestCallbackStoreMBean
+{    
+   private static Logger log = Logger.getLogger(TestCallbackStore.class);
+   private static  byte[] memHolder;
+   
+   static
+   {
+      long max = Runtime.getRuntime().maxMemory();
+      log.info("max mem: " + max);
+      int memSize = (int) (max * 0.9);
+      memHolder = new byte[memSize];
+      log.info("memHolder.length: " + memHolder.length);
+   }
+   
+   private int size;
+   
+   public String getStoreFilePath() {return null;}
+   public String getStoreFileSuffix() {return null;}
+   public void setStoreFilePath(String filePath) {}
+   public void setStoreFileSuffix(String fileSuffix) {}
+   public void add(Serializable object) throws IOException
+   {
+      if (size > 0)
+         return;
+      
+      size++;
+      log.info("TestCallbackStore received callback");
+      
+      synchronized (TestCallbackStore.class)
+      {
+         TestCallbackStore.class.notifyAll();
+      }
+   }
+   public void create() throws Exception {log.info("create()");}
+   public void destroy() {log.info("destroy()");}
+   public Object getNext() throws IOException {log.info("getNext()"); return null;}
+   public boolean getPurgeOnShutdown()  {log.info("getPurgeOnShutdown()"); return false;}
+   public void purgeFiles() {log.info("purgeFiles()");}
+   public void setConfig(Map config) {log.info("setConfig()");}
+   public void setPurgeOnShutdown(boolean purgeOnShutdown) {log.info("setPurgeOnShutdown()");}
+   public int size()  {log.info("size()"); return size;}
+   public void start() throws Exception {log.info("start()");}
+   public void stop() {log.info("stop()");}
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackStoreMBean.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackStoreMBean.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestCallbackStoreMBean.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,31 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import org.jboss.remoting.callback.CallbackStoreMBean;
+
+public interface TestCallbackStoreMBean extends CallbackStoreMBean
+{
+
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestNetworkRegistry.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestNetworkRegistry.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestNetworkRegistry.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,54 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.detection.ServerInvokerMetadata;
+import org.jboss.remoting.ident.Identity;
+import org.jboss.remoting.network.NetworkRegistry;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 6, 2008
+ * </p>
+ */
+public class TestNetworkRegistry extends NetworkRegistry implements TestNetworkRegistryMBean
+{
+   static Logger log = Logger.getLogger(TestNetworkRegistry.class);
+   
+   int counter;
+   
+   public void addServer(Identity identity, ServerInvokerMetadata[] invokers)
+   {
+      counter++;
+      log.info("addServer() called");
+   }
+   
+   public int getCounter()
+   {
+      return counter;
+   }
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestNetworkRegistryMBean.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestNetworkRegistryMBean.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestNetworkRegistryMBean.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,38 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import org.jboss.remoting.network.NetworkRegistryMBean;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 6, 2008
+ * </p>
+ */
+public interface TestNetworkRegistryMBean extends NetworkRegistryMBean
+{
+   public int getCounter();
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerInvocationHandler.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerInvocationHandler.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerInvocationHandler.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,55 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import javax.management.MBeanServer;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+
+public class TestServerInvocationHandler implements TestServerInvocationHandlerMBean
+{
+   static Logger log = Logger.getLogger(TestServerInvocationHandler.class);
+   int counter;
+   
+   public void addListener(InvokerCallbackHandler callbackHandler) {}
+
+   public Object invoke(final InvocationRequest invocation) throws Throwable
+   {
+      counter++;
+      log.info("ServerInvocationHandler processing invocation");
+      return invocation.getParameter();
+   }
+   
+   public void removeListener(InvokerCallbackHandler callbackHandler) {}
+   public void setMBeanServer(MBeanServer server) {}
+   public void setInvoker(ServerInvoker invoker) {}
+   
+   public int getCounter()
+   {
+      return counter;
+   }
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerInvocationHandlerMBean.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerInvocationHandlerMBean.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerInvocationHandlerMBean.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,38 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import org.jboss.remoting.ServerInvocationHandler;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 5, 2008
+ * </p>
+ */
+public interface TestServerInvocationHandlerMBean extends ServerInvocationHandler
+{
+   public int getCounter();
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerSocketFactory.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerSocketFactory.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerSocketFactory.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,88 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.security.SSLServerSocketFactoryService;
+
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 7, 2008
+ * </p>
+ */
+public class TestServerSocketFactory
+   extends SSLServerSocketFactoryService
+   implements TestServerSocketFactoryMBean
+{
+   private static Logger log = Logger.getLogger(TestServerSocketFactory.class);
+   
+   int counter;
+   
+   public ServerSocket createServerSocket()
+   throws IOException
+   {
+      counter++;
+      log.info("createServerSocket()");
+      return super.createServerSocket();
+   }
+
+   public ServerSocket createServerSocket( int port )
+   throws IOException
+   {
+      counter++;
+      log.info("createServerSocket(port)");
+      return super.createServerSocket(port);
+   }
+
+   public ServerSocket createServerSocket( int port,
+                                           int backlog )
+   throws IOException
+   {
+      counter++;
+      log.info("createServerSocket(port, backlog)");
+      return super.createServerSocket(port, backlog);
+   }
+
+   public ServerSocket createServerSocket( int         port,
+                                           int         backlog,
+                                           InetAddress ifAddress )
+   throws IOException
+   {
+      counter++;
+      log.info("createServerSocket(port, backlog, ifAddress)");
+      return super.createServerSocket(port, backlog, ifAddress);
+   }
+
+   public int getCounter()
+   {
+      return counter;
+   }
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerSocketFactoryMBean.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerSocketFactoryMBean.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/TestServerSocketFactoryMBean.java	2008-05-07 23:42:08 UTC (rev 4137)
@@ -0,0 +1,38 @@
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.security;
+
+import org.jboss.remoting.security.ServerSocketFactoryMBean;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright May 7, 2008
+ * </p>
+ */
+public interface TestServerSocketFactoryMBean extends ServerSocketFactoryMBean
+{
+   public int getCounter();
+}
+

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/keystore
===================================================================
(Binary files differ)


Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/keystore
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/truststore
===================================================================
(Binary files differ)


Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/security/truststore
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream




More information about the jboss-remoting-commits mailing list