[jboss-cvs] JBossAS SVN: r63605 - trunk/ejb3/src/test/org/jboss/ejb3/test/ssl/unit.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 22 09:11:35 EDT 2007


Author: wolfc
Date: 2007-06-22 09:11:35 -0400 (Fri, 22 Jun 2007)
New Revision: 63605

Modified:
   trunk/ejb3/src/test/org/jboss/ejb3/test/ssl/unit/SSLUnitTestCase.java
Log:
Check for proxy uri

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ssl/unit/SSLUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ssl/unit/SSLUnitTestCase.java	2007-06-22 10:51:30 UTC (rev 63604)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ssl/unit/SSLUnitTestCase.java	2007-06-22 13:11:35 UTC (rev 63605)
@@ -21,9 +21,14 @@
  */
 package org.jboss.ejb3.test.ssl.unit;
 
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.jboss.ejb3.test.ssl.BusinessInterface;
+import org.jboss.remoting.InvokerLocator;
 import org.jboss.test.JBossTestCase;
 import junit.framework.Test;
 
@@ -45,6 +50,22 @@
       super(name);
    }
 
+   private static String getProxyUri(Object proxy) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException
+   {
+//      System.err.println("class: " + proxy.getClass());
+//      for(Class c : proxy.getClass().getClasses())
+//      {
+//         System.err.println(" - " + c);
+//      }
+      InvocationHandler handler = Proxy.getInvocationHandler(proxy);
+//      System.err.println("invocationHandler: " + handler);
+//      System.err.println("invocationHandler: " + handler.getClass());
+      Field f = handler.getClass().getDeclaredField("uri");
+      f.setAccessible(true);
+      InvokerLocator locator = (InvokerLocator) f.get(handler);
+      return locator.getOriginalURI();
+   }
+   
    public void testNoDefaultBinding() throws Exception
    {
       System.out.println("*** TEST No default binding");
@@ -66,6 +87,8 @@
       System.out.println("*** TEST SSL Bindings");
       InitialContext ctx = new InitialContext();
       BusinessInterface sf = (BusinessInterface)ctx.lookup("StatefulSSL");
+      String proxyUri = getProxyUri(sf);
+      assertTrue("proxy uri should start with sslsocket", proxyUri.startsWith("sslsocket"));
       assertEquals(sf.echo("123"), "*** 123 ***");
       
       BusinessInterface sfc = (BusinessInterface)ctx.lookup("StatefulClusteredSSL");
@@ -84,6 +107,8 @@
       System.out.println("*** TEST Normal Bindings");
       InitialContext ctx = new InitialContext();
       BusinessInterface sf = (BusinessInterface)ctx.lookup("StatefulNormal");
+      String proxyUri = getProxyUri(sf);
+      assertTrue("proxy uri should start with sslsocket", proxyUri.startsWith("socket"));
       assertEquals(sf.echo("123"), "*** 123 ***");
       
       BusinessInterface sfc = (BusinessInterface)ctx.lookup("StatefulClusteredNormal");




More information about the jboss-cvs-commits mailing list