[jboss-remoting-commits] JBoss Remoting SVN: r6276 - in remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275: src/main/org/jboss/remoting and 17 other directories.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Mar 1 22:35:31 EST 2011


Author: jbertram at redhat.com
Date: 2011-03-01 22:35:31 -0500 (Tue, 01 Mar 2011)
New Revision: 6276

Added:
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/connection/identity/ServerIdentityTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/socketfactory/ConfigurationMapChangeTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/bisocket/dos/
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/socket/retriable/
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityVersionTestServer.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestClient.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestClient.java
Removed:
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityVersionTestServer.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestClient.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestClient.java
Modified:
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/build.xml
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Client.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/ConnectionValidator.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/InvokerRegistry.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Lease.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Remoting.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/ServerInvoker.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/connection/params/ConnectionValidatorConfigurationTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/ServletConfigurationMapTestClient.java
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF/
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/remoting-servlet-service.xml
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/remoting-servlet-service.xml
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/ssl/keystore
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/ssl/remoting-sslservlet-service.xml
   remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/ssl/truststore
Log:
JBPAPP-6004


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275
___________________________________________________________________
Added: svn:mergeinfo
   + /remoting2/branches/2.2:6106,6109,6111,6168-6174,6177-6178,6181-6182,6185-6186,6190,6198,6200,6204-6205,6212,6218-6219,6222,6224,6226,6253,6261-6263,6266-6267,6271-6273

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/build.xml
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/build.xml	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/build.xml	2011-03-02 03:35:31 UTC (rev 6276)
@@ -1669,6 +1669,8 @@
          <param name="jboss-junit-configuration" value="${module.version.extension}"/>
          <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
          <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+         <param name="clientImplementsServerIdentity" value="true"/>
+         <param name="serverImplementsServerIdentity" value="true"/>
       </antcall>
       
       <!-- ******************************************************************************** -->
@@ -1682,6 +1684,8 @@
          <param name="client.version" value=""/>
          <param name="server.version" value="2"/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="false"/>
+         <param name="serverImplementsServerIdentity" value="true"/>
       </antcall>
       <antcall target="tests.versioning.all_transports" inheritrefs="true">
          <param name="jboss-junit-configuration" value="2_2_3_SP2-server"/>
@@ -1692,6 +1696,8 @@
          <param name="client.version" value="2"/>
          <param name="server.version" value=""/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="true"/>
+         <param name="serverImplementsServerIdentity" value="false"/>
       </antcall>
       
       <!-- ******************************************************************************** -->
@@ -1705,6 +1711,8 @@
          <param name="client.version" value=""/>
          <param name="server.version" value="2"/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="false"/>
+         <param name="serverImplementsServerIdentity" value="true"/>
       </antcall>
       <antcall target="tests.versioning.all_transports" inheritrefs="true">
          <param name="jboss-junit-configuration" value="2_2_3_SP1-server"/>
@@ -1715,6 +1723,8 @@
          <param name="client.version" value="2"/>
          <param name="server.version" value=""/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="true"/>
+         <param name="serverImplementsServerIdentity" value="false"/>
       </antcall>
             
       <!-- ******************************************************************************** -->
@@ -1728,6 +1738,8 @@
          <param name="client.version" value=""/>
          <param name="server.version" value="2"/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="false"/>
+         <param name="serverImplementsServerIdentity" value="true"/>
       </antcall>
       <antcall target="tests.versioning.all_transports" inheritrefs="true">
          <param name="jboss-junit-configuration" value="2_2_3-server"/>
@@ -1738,6 +1750,8 @@
          <param name="client.version" value="2"/>
          <param name="server.version" value=""/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="true"/>
+         <param name="serverImplementsServerIdentity" value="false"/>
       </antcall>
          
       <!-- ******************************************************************************** -->
@@ -1751,6 +1765,8 @@
          <param name="client.version" value=""/>
          <param name="server.version" value="2"/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="false"/>
+         <param name="serverImplementsServerIdentity" value="true"/>
       </antcall>
       <antcall target="tests.versioning.all_transports" inheritrefs="true">
          <param name="jboss-junit-configuration" value="2_2_2_SP11-server"/>
@@ -1761,6 +1777,8 @@
          <param name="client.version" value="2"/>
          <param name="server.version" value=""/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="true"/>
+         <param name="serverImplementsServerIdentity" value="false"/>
       </antcall>
  
       <!-- ******************************************************************************** -->
@@ -1774,6 +1792,8 @@
          <param name="client.version" value=""/>
          <param name="server.version" value="2"/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="false"/>
+         <param name="serverImplementsServerIdentity" value="true"/>
       </antcall>
       <antcall target="tests.versioning.all_transports" inheritrefs="true">
          <param name="jboss-junit-configuration" value="2_2_2_SP10-server"/>
@@ -1784,6 +1804,8 @@
          <param name="client.version" value="2"/>
          <param name="server.version" value=""/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="true"/>
+         <param name="serverImplementsServerIdentity" value="false"/>
       </antcall>
    
       <!-- ******************************************************************************** -->
@@ -1797,6 +1819,8 @@
          <param name="client.version" value=""/>
          <param name="server.version" value="2"/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="false"/>
+         <param name="serverImplementsServerIdentity" value="true"/>
       </antcall>
       <antcall target="tests.versioning.all_transports" inheritrefs="true">
          <param name="jboss-junit-configuration" value="2_2_2_SP9-server"/>
@@ -1807,6 +1831,8 @@
          <param name="client.version" value="2"/>
          <param name="server.version" value=""/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="true"/>
+         <param name="serverImplementsServerIdentity" value="false"/>
     </antcall>
        
       <!-- ******************************************************************************** -->
@@ -1820,6 +1846,8 @@
          <param name="client.version" value=""/>
          <param name="server.version" value="2"/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="false"/>
+         <param name="serverImplementsServerIdentity" value="true"/>
       </antcall>
       <antcall target="tests.versioning.all_transports" inheritrefs="true">
          <param name="jboss-junit-configuration" value="2_2_2_SP7-server"/>
@@ -1830,6 +1858,8 @@
          <param name="client.version" value="2"/>
          <param name="server.version" value=""/>
          <param name="check_connection" value="false"/>
+         <param name="clientImplementsServerIdentity" value="true"/>
+         <param name="serverImplementsServerIdentity" value="false"/>
     </antcall>
     
       <!-- ******************************************************************************** -->
@@ -1843,6 +1873,8 @@
            <param name="client.version" value=""/>
            <param name="server.version" value="2"/>
            <param name="check_connection" value="false"/>
+           <param name="clientImplementsServerIdentity" value="false"/>
+           <param name="serverImplementsServerIdentity" value="true"/>
         </antcall>
         <antcall target="tests.versioning.all_transports" inheritrefs="true">
            <param name="jboss-junit-configuration" value="2_2_2_SP4-server"/>
@@ -1853,6 +1885,8 @@
            <param name="client.version" value="2"/>
            <param name="server.version" value=""/>
            <param name="check_connection" value="false"/>
+           <param name="clientImplementsServerIdentity" value="true"/>
+           <param name="serverImplementsServerIdentity" value="false"/>
         </antcall>
     
       <!-- ******************************************************************************** -->
@@ -1866,6 +1900,8 @@
            <param name="client.version" value=""/>
            <param name="server.version" value="2"/>
            <param name="check_connection" value="false"/>
+           <param name="clientImplementsServerIdentity" value="false"/>
+           <param name="serverImplementsServerIdentity" value="true"/>
         </antcall>
         <antcall target="tests.versioning.all_transports" inheritrefs="true">
            <param name="jboss-junit-configuration" value="2_2_2_SP2-server"/>
@@ -1876,6 +1912,8 @@
            <param name="client.version" value="2"/>
            <param name="server.version" value=""/>
            <param name="check_connection" value="false"/>
+           <param name="clientImplementsServerIdentity" value="true"/>
+           <param name="serverImplementsServerIdentity" value="false"/>
         </antcall>
  
       <!-- ******************************************************************************** -->
@@ -1889,6 +1927,8 @@
            <param name="client.version" value=""/>
            <param name="server.version" value="2"/>
            <param name="check_connection" value="false"/>
+           <param name="clientImplementsServerIdentity" value="false"/>
+           <param name="serverImplementsServerIdentity" value="true"/>
         </antcall>
         <antcall target="tests.versioning.all_transports" inheritrefs="true">
            <param name="jboss-junit-configuration" value="2_2_2_SP1-server"/>
@@ -1899,6 +1939,8 @@
            <param name="client.version" value="2"/>
            <param name="server.version" value=""/>
            <param name="check_connection" value="false"/>
+           <param name="clientImplementsServerIdentity" value="true"/>
+           <param name="serverImplementsServerIdentity" value="false"/>
         </antcall>
     
       <!-- ******************************************************************************** -->
@@ -1912,6 +1954,8 @@
            <param name="client.version" value=""/>
            <param name="server.version" value="2"/>
            <param name="check_connection" value="false"/>
+           <param name="clientImplementsServerIdentity" value="false"/>
+           <param name="serverImplementsServerIdentity" value="true"/>
         </antcall>
         <antcall target="tests.versioning.all_transports" inheritrefs="true">
            <param name="jboss-junit-configuration" value="2_2_2_GA-server"/>
@@ -1922,11 +1966,13 @@
            <param name="client.version" value="2"/>
            <param name="server.version" value=""/>
            <param name="check_connection" value="false"/>
+           <param name="clientImplementsServerIdentity" value="true"/>
+           <param name="serverImplementsServerIdentity" value="false"/>
         </antcall>
 
      <!-- ******************************************************************************** -->
      <!--  Current <- -> 2.2.0.SP4 -->
-       <antcall target="tests.versioning.all_transports" inheritrefs="true">
+       <antcall target="tests.versioning.all_transports_but_bisocket" inheritrefs="true">
           <param name="jboss-junit-configuration" value="2_2_0_SP4-client"/>
           <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_0_SP4/jboss-remoting.jar"/>
           <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
@@ -1936,7 +1982,7 @@
           <param name="server.version" value="2"/>
           <param name="check_connection" value="false"/>
        </antcall>
-       <antcall target="tests.versioning.all_transports" inheritrefs="true">
+       <antcall target="tests.versioning.all_transports_but_bisocket" inheritrefs="true">
           <param name="jboss-junit-configuration" value="2_2_0_SP4-server"/>
           <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_0_SP4/jboss-remoting.jar"/>
           <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
@@ -2167,7 +2213,9 @@
            description="Runs remoting fuctional tests with different remoting versions for client and server."
            depends="jars, tests.jars">
       <mkdir dir="${output.tests.results}"/>
-     <echo>Running: ${jboss-junit-configuration}</echo>
+      <echo>Running: ${jboss-junit-configuration}</echo>
+      <echo>clientImplementsServerIdentity: ${clientImplementsServerIdentity}</echo>
+      <echo>serverImplementsServerIdentity: ${serverImplementsServerIdentity}</echo>
       <junit printsummary="true" fork="yes" includeantruntime="true">
          <classpath>
             <path refid="third_party.classpath"/>
@@ -2200,6 +2248,7 @@
             <fileset dir="${tests.compile.dir}">
                <include name="**/remoting/versioning/transport/**/*TestCase.class"/>
                <include name="**/remoting/versioning/lease/**/*TestCase.class"/>
+               <include name="**/remoting/versioning/identity/*TestCase.class"/>
                <exclude name="**/remoting/**/multiplex/**/*.class"/>
             </fileset>
          </batchtest>

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Client.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Client.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Client.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -220,6 +220,8 @@
    private Set connectionListeners = new HashSet();
    
    private boolean useClientConnectionIdentity;
+   
+   private boolean useServerConnectionIdentity;
 
    // Constructors ---------------------------------------------------------------------------------
 
@@ -318,6 +320,27 @@
                }
             }
          }
+         o = configuration.get(Remoting.USE_SERVER_CONNECTION_IDENTITY);
+         if (o instanceof String)
+         {
+            useServerConnectionIdentity = Boolean.valueOf((String) o).booleanValue();
+         }
+         else if (o != null)
+         {
+            log.warn("value of " + Remoting.USE_SERVER_CONNECTION_IDENTITY + " must be a String: " + o); 
+         }
+         else
+         {
+            if (locator.getParameters() != null)
+            {
+               o = locator.getParameters().get(Remoting.USE_SERVER_CONNECTION_IDENTITY);
+               if (o != null)
+               {
+                  useServerConnectionIdentity = Boolean.valueOf((String) o).booleanValue();
+                  this.configuration.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, o);
+               }
+            }
+         }
       }
       
       Map tempMap = new HashMap();

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/ConnectionValidator.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/ConnectionValidator.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/ConnectionValidator.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -244,6 +244,8 @@
    private MicroRemoteClientInvoker sharedInvoker;
    private LeasePinger leasePinger;
    private boolean useClientConnectionIdentity;
+   private boolean useServerConnectionIdentity;
+   private String serverId;
 
    // Constructors ---------------------------------------------------------------------------------
 
@@ -738,6 +740,27 @@
                         " to a boolean: must be a String");
             }
          }
+         o = config.get(Remoting.USE_SERVER_CONNECTION_IDENTITY);
+         if (o != null)
+         {
+            if (o instanceof String)
+            {
+               try
+               {
+                  useServerConnectionIdentity = Boolean.valueOf(((String) o)).booleanValue();
+               }
+               catch (Exception e)
+               {
+                  log.warn(this + " could not convert " + Remoting.USE_SERVER_CONNECTION_IDENTITY + " value" +
+                           " to a boolean: " + o);
+               }
+            }
+            else
+            {
+               log.warn(this + " could not convert " + Remoting.USE_SERVER_CONNECTION_IDENTITY + " value" +
+                        " to a boolean: must be a String");
+            }
+         }
       }
    }
    
@@ -791,6 +814,12 @@
       {
          Map metadata = new HashMap();
          metadata.put(ServerInvoker.INVOKER_SESSION_ID, invokerSessionId);
+         
+         if (useServerConnectionIdentity)
+         {
+            metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
+         }
+         
          InvocationRequest ir =
             new InvocationRequest(null, Subsystem.SELF, "$PING$", metadata, null, null);
 
@@ -800,12 +829,63 @@
          if (o instanceof Boolean && !((Boolean) o).booleanValue())
          {
             // Server indicates lease has stopped.
-            throw new Exception("server indicates lease has stopped");
+            throw new Exception();
          }
+         if (o instanceof InvocationResponse)
+         {
+            Object result = ((InvocationResponse) o).getResult();
+            if (result instanceof Boolean && !((Boolean) result).booleanValue())
+            {
+               // Server indicates lease has stopped.
+               throw new Exception();
+            }
+            if (useServerConnectionIdentity)
+            {
+               Map map =  ((InvocationResponse) o).getPayload();
+               if (map != null)
+               {
+                  String s = (String) map.get(Remoting.SERVER_ID);
+                  if (s != null)
+                  {
+                     if (serverId == null)
+                     {
+                        serverId = s;
+                        pingWorked = true;
+                        if (trace) log.trace(this + " set serverId to " + serverId);
+                     }
+                     else
+                     {
+                        pingWorked = s.equals(serverId);
+                        if (!pingWorked)
+                        {
+                           if (trace) log.trace(this + " detected new serverId: " + s + " != " + serverId);
+                        }
+                     }
+                  }
+                  else
+                  {
+                     pingWorked = true;
+                  }
+               }
+               else
+               {
+                  pingWorked = true;
+               }
+            }
+         }
+         else
+         {
+            pingWorked = true;
+         }
 
-         if (trace) { log.trace("ConnectionValidator got successful ping using " + clientInvoker);}
-
-         pingWorked = true;
+         if (pingWorked)
+         {
+            if (trace) { log.trace("ConnectionValidator got successful ping using " + clientInvoker);}
+         }
+         else
+         {
+            if (trace) { log.trace("ConnectionValidator did not get successful ping response " + clientInvoker);}
+         }
       }
       catch (Throwable t)
       {
@@ -823,17 +903,69 @@
       {
          // Sending null client id as don't want to trigger lease on server side. This also means
          // that client connection validator will NOT impact client lease, so can not depend on it
-         // to maintain client lease with the server.
-         InvocationRequest ir =
-            new InvocationRequest(null, Subsystem.SELF, "$PING$", null, null, null);
+         // to maintain client lease with the server
+         
+         InvocationRequest ir = null;
+         if (useServerConnectionIdentity)
+         {
+            Map metadata = new HashMap();
+            metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
+            ir = new InvocationRequest(null, Subsystem.SELF, "$PING$", metadata, null, null);
+         }
+         else
+         {
+            ir = new InvocationRequest(null, Subsystem.SELF, "$PING$", null, null, null);
+         }
 
          if (trace) { log.trace("pinging, sending " + ir + " over " + clientInvoker); }
 
-         clientInvoker.invoke(ir);
+         Object o = clientInvoker.invoke(ir);
+         if (useServerConnectionIdentity && o instanceof InvocationResponse)
+         {
+            Map map =  ((InvocationResponse) o).getPayload();
+            if (map != null)
+            {
+               String s = (String) map.get(Remoting.SERVER_ID);
+               if (s != null)
+               {
+                  if (serverId == null)
+                  {
+                     serverId = s;
+                     pingWorked = true;
+                     if (trace) log.trace(this + " set serverId to " + serverId);
+                  }
+                  else
+                  {
+                     pingWorked = s.equals(serverId);
+                     if (!pingWorked)
+                     {
+                        if (trace) log.trace(this + " detected new serverId: " + s + " != " + serverId);
+                     }
+                  }
+               }
+               else
+               {
+                  pingWorked = true;
+               }
+            }
+            else
+            {
+               pingWorked = true;
+            }
+         }
+         else
+         {
+            pingWorked = true;
+         }
 
-         if (trace) { log.trace("ConnectionValidator got successful ping using " + clientInvoker);}
-
-         pingWorked = true;
+         if (pingWorked)
+         {
+            if (trace) { log.trace("ConnectionValidator got successful ping using " + clientInvoker);}
+         }
+         else
+         {
+            if (trace) { log.trace("ConnectionValidator did not get successful ping response " + clientInvoker);}
+         }
       }
       catch (Throwable t)
       {

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/InvokerRegistry.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/InvokerRegistry.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/InvokerRegistry.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -285,6 +285,12 @@
             return invoker;
          }
 
+         Map orginalConfiguration = null; 
+         if(configuration != null)
+         {
+            orginalConfiguration = new HashMap(configuration);
+         }
+         
          boolean isForceRemote = false;
          boolean isPassByValue = false;
          Map parameters = locator.getParameters();
@@ -333,7 +339,7 @@
                invoker = localInvoker;
                InvokerLocator l = invoker.getLocator();
 
-               addRegisteredClientInvoker(invoker, l, configuration);
+               addRegisteredClientInvoker(invoker, l, orginalConfiguration);
             }
          }
          
@@ -349,7 +355,7 @@
 
             InvokerLocator l = invoker.getLocator();
 
-            addRegisteredClientInvoker(invoker, l, configuration);
+            addRegisteredClientInvoker(invoker, l, orginalConfiguration);
          }
          return invoker;
       }

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Lease.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Lease.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Lease.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -23,6 +23,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.remoting.util.TimerUtil;
+import org.jboss.util.id.GUID;
 
 import java.util.Collection;
 import java.util.HashMap;
@@ -59,6 +60,9 @@
 
    private static final Logger log = Logger.getLogger(Lease.class);
    private static final boolean isTraceEnabled = log.isTraceEnabled();
+   
+   /** Used by ConnectionValidator to detect a change of server. **/
+   protected String leaseId = new GUID().toString();
 
    public Lease(String clientSessionId, long leasePeriod, String locatorurl, Map requestPayload,
                 ConnectionNotifier notifier, Map clientLeases)
@@ -355,6 +359,11 @@
    {
       return leasePingerId;
    }
+   
+   protected String getLeaseId()
+   {
+      return leaseId;
+   }
 
    private void stopLease()
    {

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -670,9 +670,6 @@
 
    protected LeasePinger getLeasePinger()
    {
-      synchronized(clientLeaseLock)
-      {
-         return leasePinger;
-      }
+      return leasePinger;
    }
 }

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Remoting.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Remoting.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/Remoting.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -89,7 +89,8 @@
     * all connections it participated in are now gone.
     */
    public static final String USE_CLIENT_CONNECTION_IDENTITY = "useClientConnectionIdentity";
-//   public static final String USE_SERVER_CONNECTION_IDENTITY = "useServerConnectionIdentity";
+   public static final String USE_SERVER_CONNECTION_IDENTITY = "useServerConnectionIdentity";
+   public static final String SERVER_ID = "serverID";
    
    /**
     * A flag for indicating that when a client side Remoting unmarshaller uses the Thread

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/ServerInvoker.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/ServerInvoker.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/ServerInvoker.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -38,6 +38,7 @@
 import org.jboss.remoting.transport.PortUtil;
 import org.jboss.remoting.util.LocalHostUtil;
 import org.jboss.remoting.serialization.ClassLoaderUtility;
+import org.jboss.util.id.GUID;
 import org.jboss.util.threadpool.BasicThreadPool;
 import org.jboss.util.threadpool.BlockingMode;
 import org.jboss.util.threadpool.ThreadPool;
@@ -265,6 +266,10 @@
    protected boolean registerCallbackListeners = true;
    
    protected boolean useClientConnectionIdentity;
+   protected boolean useServerConnectionIdentity;
+   
+   /** Used by ConnectionValidator to detect a change of server. **/
+   protected String serverId = new GUID().toString();
 
    // Constructors ---------------------------------------------------------------------------------
 
@@ -720,6 +725,16 @@
       this.useClientConnectionIdentity = useClientConnectionIdentity;
    }
 
+   public boolean isUseServerConnectionIdentity()
+   {
+      return useServerConnectionIdentity;
+   }
+
+   public void setUseServerConnectionIdentity(boolean useServerConnectionIdentity)
+   {
+      this.useServerConnectionIdentity = useServerConnectionIdentity;
+   }
+
    public Object invoke(Object invoke) throws IOException
    {
       InvocationRequest request = null;
@@ -783,10 +798,32 @@
                if (invokerSessionId != null)
                {
                   // Comes from ConnectionValidator configured to tie validation with lease.
-                  boolean response = checkForClientLease(invokerSessionId);
-                  if (trace) log.trace(this + " responding " + response + " to $PING$ for invoker sessionId " + invokerSessionId);
-                  return new Boolean(response);
+                  String leaseId = checkForClientLease(invokerSessionId);
+                  Boolean success = leaseId == null ? Boolean.FALSE : Boolean.TRUE;
+                  if (trace) log.trace(this + " responding " + leaseId + " to $PING$ for invoker sessionId " + invokerSessionId);
+                  if (metadata.get(Remoting.USE_SERVER_CONNECTION_IDENTITY) != null)
+                  {
+                     Map responseMap = new HashMap();
+                     responseMap.put(Remoting.SERVER_ID, leaseId);
+                     if (trace) log.trace(this + " returning leaseId: " + leaseId);
+                     return new InvocationResponse(invocation.getSessionId(), success, false, responseMap);
+                  }
+                  else
+                  {
+                     if (trace) log.trace(this + " not returning leaseId: " + leaseId);
+                     return success;
+                  }
                }
+               else
+               {
+                  if (metadata.get(Remoting.USE_SERVER_CONNECTION_IDENTITY) != null)
+                  {
+                     Map responseMap = new HashMap();
+                     responseMap.put(Remoting.SERVER_ID, serverId);
+                     if (trace) log.trace(this + " returning serverId: " + serverId);
+                     return new InvocationResponse(invocation.getSessionId(), null, false, responseMap);
+                  }
+               }
             }
             
             if (leaseManagement)
@@ -1182,6 +1219,13 @@
          useClientConnectionIdentity = Boolean.valueOf(useClientConnectionIdentityString).booleanValue();
       }
       
+      // config for useServerConnectionIdentity
+      String useServerConnectionIdentityString = (String)config.get(Remoting.USE_SERVER_CONNECTION_IDENTITY);
+      if(useServerConnectionIdentityString != null)
+      {
+         useServerConnectionIdentity = Boolean.valueOf(useServerConnectionIdentityString).booleanValue();
+      }
+      
       // Inject ConnectionListener
       String connectionListener = (String)config.get(CONNECTION_LISTENER);
       if (connectionListener != null)
@@ -1859,7 +1903,7 @@
       }
    }
 
-   private boolean checkForClientLease(String invokerSessionId)
+   private String checkForClientLease(String invokerSessionId)
    {
       if(leaseManagement && invokerSessionId != null)
       {
@@ -1869,16 +1913,16 @@
          if(clientLease == null)
          {
             if(trace) { log.trace("No lease established for invoker session id (" + invokerSessionId + ")"); }
-            return false;
+            return null;
          }
          else
          {
             if(trace) { log.trace("Found lease for invoker session id (" + invokerSessionId + ")"); }
-            return true;
+            return clientLease.getLeaseId();
          }
       }
 
-      return false;
+      return null;
    }
 
    /**

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/bisocket/Bisocket.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -53,7 +53,7 @@
     */
    public static final String PING_WINDOW_FACTOR = "pingWindowFactor";
    public static final int PING_WINDOW_FACTOR_DEFAULT = 2;
-
+   
    /**
     * Configuration key and default value for number of retries
     * BisocketServerInvoker.ControlConnectionThread and 
@@ -76,4 +76,13 @@
     */
    public static final String SECONDARY_BIND_PORT = "secondaryBindPort";
    public static final String SECONDARY_CONNECT_PORT = "secondaryConnectPort";
+
+   /**
+    * Configuration keys and default values for parameters related to DOS attack
+    * on BisocketServerInvoker.SecondaryServerSocketThread
+    */
+   public static final String SECONDARY_MAX_THREADS = "secondaryMaxThreads";
+   public static final String SECONDARY_TIMEOUT = "secondaryTimeout";
+   public static final int SECONDARY_MAX_THREADS_DEFAULT = 50;
+   public static final int SECONDARY_TIMEOUT_DEFAULT = 60000;
 }

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -53,7 +53,9 @@
 import org.jboss.remoting.transport.socket.SocketServerInvoker;
 import org.jboss.logging.Logger;
 
+import EDU.oswego.cs.dl.util.concurrent.Semaphore;
 
+
 /**
  *
  * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
@@ -85,6 +87,8 @@
    protected boolean isCallbackServer = false;
    protected int secondaryBindPort = -1;
    protected int secondaryConnectPort = -1;
+   protected int dosMaxThreads = Bisocket.SECONDARY_MAX_THREADS_DEFAULT;
+   protected int dosTimeout = Bisocket.SECONDARY_TIMEOUT_DEFAULT;
 
 
    public static BisocketServerInvoker getBisocketServerInvoker(String listenerId)
@@ -358,6 +362,30 @@
    }
    
    
+   public int getDosMaxThreads()
+   {
+      return dosMaxThreads;
+   }
+
+
+   public void setDosMaxThreads(int dosMaxThreads)
+   {
+      this.dosMaxThreads = dosMaxThreads;
+   }
+
+
+   public int getDosTimeout()
+   {
+      return dosTimeout;
+   }
+
+
+   public void setDosTimeout(int dosTimeout)
+   {
+      this.dosTimeout = dosTimeout;
+   }
+
+
    public int getPingFrequency()
    {
       return pingFrequency;
@@ -509,6 +537,42 @@
          log.warn("\"" + Bisocket.SECONDARY_CONNECT_PORT + "\" must be specified as a String");
       }
       
+      o = configuration.get(Bisocket.SECONDARY_MAX_THREADS);
+      if (o instanceof String && ((String) o).length() > 0)
+      {
+            try
+            {
+               dosMaxThreads = Integer.valueOf(((String) o)).intValue();
+               log.debug(this + " setting dosMaxThreads to " + dosMaxThreads);
+            }
+            catch (NumberFormatException e)
+            {
+               log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_MAX_THREADS + "\": " + o);
+            }
+      }
+      else if (o != null)
+      {
+         log.warn("\"" + Bisocket.SECONDARY_MAX_THREADS + "\" must be specified as a String");
+      }
+      
+      o = configuration.get(Bisocket.SECONDARY_TIMEOUT);
+      if (o instanceof String && ((String) o).length() > 0)
+      {
+            try
+            {
+               dosTimeout = Integer.valueOf(((String) o)).intValue();
+               log.debug(this + " setting dosTimeout to " + dosTimeout);
+            }
+            catch (NumberFormatException e)
+            {
+               log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_TIMEOUT + "\": " + o);
+            }
+      }
+      else if (o != null)
+      {
+         log.warn("\"" + Bisocket.SECONDARY_TIMEOUT + "\" must be specified as a String");
+      }
+      
       if (isCallbackServer)
       {
          socketFactory = createSocketFactory(configuration);
@@ -861,6 +925,8 @@
    {
       private ServerSocket secondaryServerSocket;
       boolean running = true;
+      Semaphore maxThreads = new Semaphore(dosMaxThreads);
+      int localDosTimeout = dosTimeout;
 
       SecondaryServerSocketThread(ServerSocket secondaryServerSocket) throws IOException
       {
@@ -881,41 +947,7 @@
             {
                Socket socket = secondaryServerSocket.accept();
                if (log.isTraceEnabled()) log.trace("accepted: " + socket);
-               DataInputStream dis = new DataInputStream(socket.getInputStream());
-               int action = dis.read();
-               String listenerId = dis.readUTF();
-
-               switch (action)
-               {
-                  case Bisocket.CREATE_CONTROL_SOCKET:
-                     BisocketClientInvoker.transferSocket(listenerId, socket, true);
-                     if (log.isTraceEnabled()) 
-                        log.trace("SecondaryServerSocketThread: created control socket: (" + socket + ")"+ listenerId);
-                     break;
-                     
-                  case Bisocket.RECREATE_CONTROL_SOCKET:
-                     BisocketClientInvoker invoker =  BisocketClientInvoker.getBisocketCallbackClientInvoker(listenerId);
-                     if (invoker == null)
-                     {
-                        log.debug("received new control socket for unrecognized listenerId: " + listenerId);
-                     }
-                     else
-                     {
-                        invoker.replaceControlSocket(socket);
-                        if (log.isTraceEnabled())
-                           log.trace("SecondaryServerSocketThread: recreated control socket: " + listenerId);
-                     }
-                     break;
-
-                  case Bisocket.CREATE_ORDINARY_SOCKET:
-                     BisocketClientInvoker.transferSocket(listenerId, socket, false);
-                     if (log.isTraceEnabled())
-                        log.trace("SecondaryServerSocketThread: transferred socket: " + listenerId);
-                     break;
-
-                  default:
-                     log.error("unrecognized action on SecondaryServerSocketThread: " + action);
-               }
+               processSocket(socket);
             }
             catch (IOException e)
             {
@@ -928,6 +960,86 @@
          }
       }
 
+      void processSocket(final Socket socket) throws IOException
+      {
+         while (true)
+         {
+            try
+            {
+               maxThreads.acquire();
+               break;
+            }
+            catch (InterruptedException e1)
+            {
+               log.trace("unexpected interrupt");
+            }
+         }
+         
+         new Thread()
+         {
+            public void run()
+            {
+               setName("processSocketThread: " + socket);
+               if (log.isTraceEnabled()) log.trace(this + " processing socket: " + socket);
+               try
+               {
+                  socket.setSoTimeout(localDosTimeout);
+                  DataInputStream dis = new DataInputStream(socket.getInputStream());
+                  int action = dis.read();
+                  String listenerId = dis.readUTF();
+
+                  switch (action)
+                  {
+                     case Bisocket.CREATE_CONTROL_SOCKET:
+                        BisocketClientInvoker.transferSocket(listenerId, socket, true);
+                        if (log.isTraceEnabled()) 
+                           log.trace("SecondaryServerSocketThread: created control socket: (" + socket + ")"+ listenerId);
+                        break;
+
+                     case Bisocket.RECREATE_CONTROL_SOCKET:
+                        BisocketClientInvoker invoker =  BisocketClientInvoker.getBisocketCallbackClientInvoker(listenerId);
+                        if (invoker == null)
+                        {
+                           log.debug("received new control socket for unrecognized listenerId: " + listenerId);
+                        }
+                        else
+                        {
+                           invoker.replaceControlSocket(socket);
+                           if (log.isTraceEnabled())
+                              log.trace("SecondaryServerSocketThread: recreated control socket: " + listenerId);
+                        }
+                        break;
+
+                     case Bisocket.CREATE_ORDINARY_SOCKET:
+                        BisocketClientInvoker.transferSocket(listenerId, socket, false);
+                        if (log.isTraceEnabled())
+                           log.trace("SecondaryServerSocketThread: transferred socket: " + listenerId);
+                        break;
+
+                     default:
+                        log.error("unrecognized action on SecondaryServerSocketThread: " + action);
+                  }
+               }
+               catch (IOException e)
+               {
+                  if (running)
+                  {
+                     log.error(this + " unable to process socket", e);
+                  }
+                  else
+                  {
+                     log.debug(this + " unable to process socket", e);
+                  }
+               }
+               finally
+               {
+                  if (log.isTraceEnabled()) log.trace(this + " processed socket: " + socket);
+                  maxThreads.release();
+               }
+            }
+         }.start();
+      }
+      
       ServerSocket getServerSocket()
       {
          return secondaryServerSocket;

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -102,6 +102,12 @@
       out.write(ACK);
       out.flush();
       int i = in.read();
+      
+      if (i != ACK)
+      {
+         throw new IOException("got " + i + " instead of " + ACK);
+      }
+      
       if (trace) { log.trace(this + " got " + i + " while checking connection"); }
    }
    

Modified: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java	2011-03-02 02:24:21 UTC (rev 6275)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -118,7 +118,7 @@
    public static long serializeTime = 0;
    public static long deserializeTime = 0;
    
-   private static final String patternString = "^.*(?:connection.*reset|connection.*closed|broken.*pipe).*$";
+   private static final String patternString = "^.*(?:connection.*reset|connection.*closed|connection.*abort|broken.*pipe|connection.*shutdown).*$";
    private static final Pattern RETRIABLE_ERROR_MESSAGE = Pattern.compile(patternString, Pattern.CASE_INSENSITIVE);
    
    /**


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Copied: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/connection/identity/ServerIdentityTestCase.java (from rev 6174, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/identity/ServerIdentityTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/connection/identity/ServerIdentityTestCase.java	                        (rev 0)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/connection/identity/ServerIdentityTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -0,0 +1,406 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, 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.connection.identity;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+
+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.ConnectionListener;
+import org.jboss.remoting.ConnectionValidator;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Remoting;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.socket.LRUPool;
+import org.jboss.remoting.transport.socket.ServerSocketWrapper;
+import org.jboss.remoting.transport.socket.ServerThread;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
+
+
+/**
+ * Unit test for JBREM-1144.
+ * 
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Nov 17, 2010
+ * </p>
+ */
+public class ServerIdentityTestCase extends TestCase
+{
+   private static Logger log = Logger.getLogger(ServerIdentityTestCase.class);
+   
+   protected String host;
+   protected int port;
+   protected String locatorURI;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected TestInvocationHandler invocationHandler;
+   protected ByteArrayOutputStream baosOut;
+   protected PrintStream originalOutPrintStream;
+   protected ByteArrayOutputStream baosErr;
+   protected PrintStream originalErrPrintStream;
+   
+   public void setUp() throws Exception
+   {
+      originalOutPrintStream = System.out;
+      baosOut = new ByteArrayOutputStream();
+      PrintStream ps = new PrintStream(baosOut);
+      setOut(ps);
+      
+      originalErrPrintStream = System.err;
+      baosErr = new ByteArrayOutputStream();
+      ps = new PrintStream(baosErr);
+      setErr(ps);
+      
+      Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
+      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);
+      
+      host = InetAddress.getLocalHost().getHostAddress();
+      port = PortUtil.findFreePort(host);
+   }
+
+   
+   public void tearDown()
+   {
+   }
+   
+   
+   public void testServerIdentityWithoutLeasing() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer(false);
+      
+      // Create client. Adding "dummy=dummy" assures that InvokerRegistry will not create a
+      // LocalClientInvoker for the ConnectionValidator.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI + "&dummy=dummy");
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      clientConfig.put("numberOfCallRetries", "3"); // for ConnectionValidator
+      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");
+      
+      // Install connection listener.
+      TestConnectionListener listener = new TestConnectionListener();
+      HashMap metadata = new HashMap();
+      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "10000");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "10000");
+      client.addConnectionListener(listener, metadata);
+      log.info(this + " added connection listener: " + listener);
+      // Allow time to get serverId of first server.
+      Thread.sleep(15000);
+      
+      // Verify listener is notified if server bounces.
+      shutdownServer();
+      log.info("SHUT DOWN SERVER");
+      Thread.sleep(1000);
+      setupServer(false);
+      log.info("SET UP NEW SERVER");
+      Thread.sleep(9000);
+      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
+      assertTrue(listener.connectionFailed);
+      
+      setOut(originalOutPrintStream);
+      String sOut = new String(baosOut.toByteArray());
+      setErr(originalErrPrintStream);
+      String sErr = new String(baosErr.toByteArray());
+      if (!(sOut.indexOf("detected new serverId:") > -1 || sErr.indexOf("detected new serverId:") > -1))
+      {
+         System.out.println(sOut); 
+         System.out.println(sErr);
+      }
+      assertTrue(sOut.indexOf("detected new serverId:") > -1 || sErr.indexOf("detected new serverId:") > -1);
+     
+      client.disconnect();
+      shutdownServer();
+     
+      log.info(getName() + " PASSES");
+   }
+   
+   public void testServerIdentityWithLeasingNewServer() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer(true);
+      
+      // Create client. Adding "dummy=dummy" assures that InvokerRegistry will not create a
+      // LocalClientInvoker for the ConnectionValidator.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI + "&dummy=dummy");
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      clientConfig.put("numberOfCallRetries", "3"); // for ConnectionValidator
+      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");
+      
+      // Install connection listener.
+      TestConnectionListener listener = new TestConnectionListener();
+      HashMap metadata = new HashMap();
+      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "10000");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "10000");
+      client.addConnectionListener(listener, metadata);
+      log.info(this + " added connection listener: " + listener);
+      // Allow time to get serverId of first server.
+      Thread.sleep(15000);
+      
+      // Verify listener is notified if server bounces.
+      shutdownServer();
+      log.info("SHUT DOWN SERVER");
+      Thread.sleep(1000);
+      setupServer(true);
+      log.info("SET UP NEW SERVER");
+      Thread.sleep(14000);
+      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
+      assertTrue(listener.connectionFailed);
+      
+      setOut(originalOutPrintStream);
+      String sOut = new String(baosOut.toByteArray());
+      setErr(originalErrPrintStream);
+      String sErr = new String(baosErr.toByteArray());
+      if (!(sOut.indexOf("detected new serverId:") > -1 || sErr.indexOf("detected new serverId:") > -1))
+      {
+         System.out.println(sOut);
+         System.out.println(sErr);
+      }
+      assertTrue(sOut.indexOf("detected new serverId:") > -1 || sErr.indexOf("detected new serverId:") > -1);
+     
+      client.disconnect();
+      shutdownServer();
+     
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   public void testServerIdentityWithLeasingNewLease() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer(true);
+      
+      // Create client. Adding "dummy=dummy" assures that InvokerRegistry will not create a
+      // LocalClientInvoker for the ConnectionValidator.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI + "&dummy=dummy");
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      clientConfig.put("numberOfCallRetries", "3"); // for ConnectionValidator
+      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");
+      
+      // Install connection listener.
+      TestConnectionListener listener = new TestConnectionListener();
+      HashMap metadata = new HashMap();
+      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "10000");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "10000");
+      client.addConnectionListener(listener, metadata);
+      log.info(this + " added connection listener: " + listener);
+      // Allow time to get serverId of first server.
+      Thread.sleep(15000);
+      
+      // Verify listener is notified if Lease is destroyed.
+      Field field = ServerInvoker.class.getDeclaredField("clientLeases");
+      field.setAccessible(true);
+      Map clientLeases = (Map) field.get(connector.getServerInvoker());
+      clientLeases.clear();
+      log.info("REMOVED LEASE");
+      Thread.sleep(15000);
+      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
+      assertTrue(listener.connectionFailed);
+      
+      setOut(originalOutPrintStream);
+      String sOut = new String(baosOut.toByteArray());
+      setErr(originalErrPrintStream);
+      String sErr = new String(baosErr.toByteArray());
+      if (!(sOut.indexOf("detected new serverId:") > -1 || sErr.indexOf("detected new serverId:") > -1))
+      {
+         System.out.println(sOut);
+         System.out.println(sErr);
+      }
+      assertTrue(sOut.indexOf("detected new serverId:") > -1 || sErr.indexOf("detected new serverId:") > -1);
+     
+      client.disconnect();
+      shutdownServer();
+     
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "socket";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   protected void addExtraServerConfig(Map config) {}
+   
+
+   private void setOut(final PrintStream ps)
+   {
+      System.setOut(ps);
+   }
+   
+   
+   private void setErr(final PrintStream ps)
+   {
+      System.setErr(ps);
+   }
+   
+   
+   protected void setupServer(boolean useLeasing) throws Exception
+   {
+      locatorURI = getTransport() + "://" + host + ":" + port + "?" + Remoting.USE_SERVER_CONNECTION_IDENTITY + "=true";
+      locatorURI += "&" + SocketServerInvoker.CHECK_CONNECTION_KEY + "=true";
+      if (useLeasing)
+      {
+         locatorURI += "&" + InvokerLocator.CLIENT_LEASE + "=true";
+         locatorURI += "&" + InvokerLocator.CLIENT_LEASE_PERIOD + "=2000";
+      }
+      String metadata = System.getProperty("remoting.metadata");
+      if (metadata != null)
+      {
+         locatorURI += "&" + metadata;
+      }
+      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);
+      if (useLeasing)
+      {
+         connector.addConnectionListener(new TestConnectionListener());
+      }
+      connector.start();
+   }
+   
+   
+   protected void shutdownServer() throws Exception
+   {
+      if (connector != null)
+      {
+         // Remoting versions 1.x and 2.2.x don't necessarily shut down all of their
+         // ServerThreads, so an exiting connection could connect to a ServerThread
+         // associated with the old ServerInvoker.
+         SocketServerInvoker invoker = (SocketServerInvoker) connector.getServerInvoker();
+         Field clientpoolField = SocketServerInvoker.class.getDeclaredField("clientpool");
+         clientpoolField.setAccessible(true);
+         Field socketWrapperField = ServerThread.class.getDeclaredField("socketWrapper");
+         socketWrapperField.setAccessible(true);
+         LRUPool clientpool = (LRUPool) clientpoolField.get(invoker);
+         Set threads = clientpool.getContents();
+         Iterator it = threads.iterator();
+         while (it.hasNext())
+         {
+            try
+            {
+               ServerThread t = (ServerThread) it.next();
+               ServerSocketWrapper socketWrapper = (ServerSocketWrapper) socketWrapperField.get(t);
+               socketWrapper.close();
+            }
+            catch (ConcurrentModificationException e)
+            {
+               log.info(this + " caught " + e.getMessage());
+            }
+         }
+         connector.stop();
+      }
+   }
+   
+   
+   static class TestInvocationHandler 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) {}
+   }
+
+   static class TestConnectionListener implements ConnectionListener
+   {
+      public boolean connectionFailed;
+      public Throwable throwable;
+      
+      public void handleConnectionException(Throwable throwable, Client client)
+      {
+         connectionFailed = true;
+         this.throwable = throwable;
+         log.info(this + " received connection notification: connectionFailed: " + connectionFailed);
+      }
+      
+   }
+}
\ No newline at end of file


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/connection/params/ConnectionValidatorConfigurationTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Copied: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/socketfactory/ConfigurationMapChangeTestCase.java (from rev 6219, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/socketfactory/ConfigurationMapChangeTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/socketfactory/ConfigurationMapChangeTestCase.java	                        (rev 0)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/socketfactory/ConfigurationMapChangeTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -0,0 +1,315 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.socketfactory;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.net.SocketFactory;
+
+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.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Remoting;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * Unit tests for JBREM-1268.
+ * 
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Jan 24, 2011
+ * </p>
+ */
+public class ConfigurationMapChangeTestCase extends TestCase
+{
+   private static Logger log = Logger.getLogger(ConfigurationMapChangeTestCase.class);
+   
+   private static boolean firstTime = true;
+   
+   protected String host;
+   protected int port;
+   protected String locatorURI;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected TestInvocationHandler invocationHandler;
+
+   
+   public void setUp() throws Exception
+   {
+      if (firstTime)
+      {
+         firstTime = false;
+         Logger.getLogger("org.jboss.remoting").setLevel(Level.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 testWithoutChangeRemote() 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 client1 = new Client(clientLocator, clientConfig);
+      client1.connect();
+      log.info("first client is connected");
+      ClientInvoker invoker1 = client1.getInvoker();
+      Client client2 = new Client(clientLocator, clientConfig);
+      client2.connect();
+      ClientInvoker invoker2 = client2.getInvoker();
+      log.info("second client is connected");
+      
+      // Test connections.
+      assertEquals("abc", client1.invoke("abc"));
+      log.info("first connection is good");
+      assertEquals("abc", client2.invoke("abc"));
+      log.info("second connection is good");
+      
+      // Verify invokers are identical.
+      assertSame(invoker1, invoker2);
+      
+      client1.disconnect();
+      client2.disconnect();
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+
+   public void testWithChangeRemote() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer("&" + Remoting.SOCKET_FACTORY_CLASS_NAME + "=" + TestSocketFactory.class.getName());
+      
+      // Create client.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      addExtraClientConfig(clientConfig);
+      Client client1 = new Client(clientLocator, clientConfig);
+      client1.connect();
+      log.info("first client is connected");
+      ClientInvoker invoker1 = client1.getInvoker();
+      Client client2 = new Client(clientLocator, clientConfig);
+      client2.connect();
+      ClientInvoker invoker2 = client2.getInvoker();
+      log.info("second client is connected");
+      
+      // Test connections.
+      assertEquals("abc", client1.invoke("abc"));
+      log.info("first connection is good");
+      assertEquals("abc", client2.invoke("abc"));
+      log.info("second connection is good");
+      
+      // Verify invokers are identical.
+      assertSame(invoker1, invoker2);
+      
+      client1.disconnect();
+      client2.disconnect();
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   public void testWithoutChangeLocal() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer("");
+      
+      // Create client.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+      HashMap clientConfig = new HashMap();
+      addExtraClientConfig(clientConfig);
+      Client client1 = new Client(clientLocator, clientConfig);
+      client1.connect();
+      log.info("first client is connected");
+      ClientInvoker invoker1 = client1.getInvoker();
+      Client client2 = new Client(clientLocator, clientConfig);
+      client2.connect();
+      ClientInvoker invoker2 = client2.getInvoker();
+      log.info("second client is connected");
+      
+      // Test connections.
+      assertEquals("abc", client1.invoke("abc"));
+      log.info("first connection is good");
+      assertEquals("abc", client2.invoke("abc"));
+      log.info("second connection is good");
+      
+      // Verify invokers are identical.
+      assertSame(invoker1, invoker2);
+      
+      client1.disconnect();
+      client2.disconnect();
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+
+   public void testWithChangeLocal() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer("&" + Remoting.SOCKET_FACTORY_CLASS_NAME + "=" + TestSocketFactory.class.getName());
+      
+      // Create client.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+      HashMap clientConfig = new HashMap();
+      addExtraClientConfig(clientConfig);
+      Client client1 = new Client(clientLocator, clientConfig);
+      client1.connect();
+      log.info("first client is connected");
+      ClientInvoker invoker1 = client1.getInvoker();
+      Client client2 = new Client(clientLocator, clientConfig);
+      client2.connect();
+      ClientInvoker invoker2 = client2.getInvoker();
+      log.info("second client is connected");
+      
+      // Test connections.
+      assertEquals("abc", client1.invoke("abc"));
+      log.info("first connection is good");
+      assertEquals("abc", client2.invoke("abc"));
+      log.info("second connection is good");
+      
+      // Verify invokers are identical.
+      assertSame(invoker1, invoker2);
+      
+      client1.disconnect();
+      client2.disconnect();
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "socket";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   protected void addExtraServerConfig(Map config) {}
+   
+
+   protected void setupServer(String extraParams) throws Exception
+   {
+      host = InetAddress.getLocalHost().getHostAddress();
+      port = PortUtil.findFreePort(host);
+      locatorURI = getTransport() + "://" + host + ":" + port + "/?timeout=10000&x=y" + extraParams;
+      String metadata = System.getProperty("remoting.metadata");
+      if (metadata != null)
+      {
+         locatorURI += "&" + metadata;
+      }
+      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();
+   }
+   
+   
+   protected void shutdownServer() throws Exception
+   {
+      if (connector != null)
+         connector.stop();
+   }
+   
+   
+   static class TestInvocationHandler 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) {}
+   }
+   
+   
+   static class TestSocketFactory extends SocketFactory
+   {
+      SocketFactory sf = SocketFactory.getDefault();
+      
+      public Socket createSocket(String arg0, int arg1) throws IOException, UnknownHostException
+      {
+         return sf.createSocket(arg0, arg1);
+      }
+      public Socket createSocket(InetAddress arg0, int arg1) throws IOException
+      {
+         return sf.createSocket(arg0, arg1);
+      }
+      public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) throws IOException, UnknownHostException
+      {
+         return sf.createSocket(arg0, arg1, arg2, arg3);
+      }
+      public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3) throws IOException
+      {
+         return sf.createSocket(arg0, arg1, arg2, arg3);
+      }
+   }
+}
\ No newline at end of file

Deleted: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java	2010-12-18 02:23:26 UTC (rev 6178)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -1,287 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, 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.transport.bisocket.dos;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.MBeanServer;
-
-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.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.transport.Connector;
-import org.jboss.remoting.transport.PortUtil;
-import org.jboss.remoting.transport.bisocket.Bisocket;
-
-/**
- * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Rev$
- * <p>
- * Copyright Oct 13, 2010
- * </p>
- */
-public class DosTestCase extends TestCase
-{
-   private static final Logger log = Logger.getLogger(DosTestCase.class);
-   private static final String CALLBACK_TEST = "callbackTest";
-   
-   private static boolean firstTime = true;
-   
-   protected String host;
-   protected int port;
-   protected int secondaryPort;
-   protected String locatorURI;
-   protected InvokerLocator serverLocator;
-   protected Connector connector;
-   protected TestInvocationHandler invocationHandler;
-   protected Object lock = new Object();
-   protected boolean dosAttackThreadRan;
-   protected boolean secondCallbackRan;
-
-   
-   public void setUp() throws Exception
-   {
-      if (firstTime)
-      {
-         firstTime = false;
-         Logger.getLogger("org.jboss.remoting").setLevel(Level.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 testDosAttack() throws Throwable
-   {
-      log.info("entering " + getName());
-      
-      // Start server.
-      setupServer();
-      
-      // Create client.
-      HashMap clientConfig = new HashMap();
-      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
-      addExtraClientConfig(clientConfig);
-      final Client client = new Client(serverLocator, clientConfig);
-      client.connect();
-      assertEquals("abc", client.invoke("abc"));
-      log.info("client is connected");
-      
-      // Add callback handler.
-      TestCallbackHandler callbackHandler = new TestCallbackHandler();
-      HashMap metadata = new HashMap();
-      metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
-      client.addListener(callbackHandler, metadata);
-      client.invoke(CALLBACK_TEST);
-      assertEquals(1, callbackHandler.counter);
-      log.info("callback handler is installed");
-      
-      // Test DOS attack. 
-      new Thread()
-      {
-         public void run()
-         {
-            try
-            {
-               Socket s = new Socket(host, secondaryPort);
-               log.info(this + " created socket " + s);
-               synchronized (lock)
-               {
-                  dosAttackThreadRan = true;
-               } 
-            }
-            catch (IOException e)
-            {
-               log.error("unable to connect to secondaryPort: " + secondaryPort, e);
-            }
-            finally
-            {
-               synchronized (lock)
-               {
-                  lock.notifyAll();
-               }  
-            }
-         }
-      }.start();
-      
-      Thread.sleep(2000);
-      
-      synchronized (lock)
-      {
-         if (!dosAttackThreadRan)
-         {
-            long start = System.currentTimeMillis();
-            long end = start + 10000;
-            while (end - System.currentTimeMillis() > 0)
-            {
-               try
-               {
-                  lock.wait(end - System.currentTimeMillis());
-               }
-               catch (InterruptedException e){
-
-               }
-            }
-         }
-      } 
-      
-      if (!dosAttackThreadRan)
-      {
-         fail("DOS attack thread did not run");
-      }
-      
-      
-      // DOS attack has occurred.  Try to add another callback handler.
-      new Thread()
-      {
-         public void run()
-         {
-            TestCallbackHandler callbackHandler2 = new TestCallbackHandler();
-            try
-            {
-               
-               HashMap metadata = new HashMap();
-               metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
-               client.addListener(callbackHandler2, metadata);
-               secondCallbackRan = true;
-               log.info(this + " second callback handler installed after DOS attack");
-            }
-            catch (Throwable e)
-            {
-               log.info(this + " second callback failed", e);
-            }    
-         }
-      }.start();
-      
-      Thread.sleep(10000);
-      assertTrue(secondCallbackRan);
-      
-      client.removeListener(callbackHandler);
-      client.disconnect();
-      connector.stop();
-   }
-   
-   protected String getTransport()
-   {
-      return "bisocket";
-   }
-   
-   
-   protected void addExtraClientConfig(Map config) {}
-   protected void addExtraServerConfig(Map config) {}
-   
-
-   protected void setupServer() throws Exception
-   {
-      host = InetAddress.getLocalHost().getHostAddress();
-      port = PortUtil.findFreePort(host);
-      secondaryPort =  PortUtil.findFreePort(host);
-      locatorURI = getTransport() + "://" + host + ":" + port + "/?secondaryBindPort=" + secondaryPort;
-      String metadata = System.getProperty("remoting.metadata");
-      if (metadata != null)
-      {
-         locatorURI += "&" + metadata;
-      }
-      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();
-   }
-   
-   
-   protected void shutdownServer() throws Exception
-   {
-      if (connector != null)
-         connector.stop();
-   }
-   
-   
-
-   static class TestInvocationHandler implements ServerInvocationHandler
-   {
-      public Set listeners = new HashSet();
-      
-      public void addListener(InvokerCallbackHandler callbackHandler)
-      {
-         listeners.add(callbackHandler);
-      }
-      public Object invoke(final InvocationRequest invocation) throws Throwable
-      {
-         if (CALLBACK_TEST.equals(invocation.getParameter()))
-         {
-            Iterator it = listeners.iterator();
-            while (it.hasNext())
-            {
-               InvokerCallbackHandler handler = (InvokerCallbackHandler) it.next();
-               handler.handleCallback(new Callback("test"));
-               log.info(this + " sent callback");
-            }
-         }
-         return invocation.getParameter();
-      }
-      public void removeListener(InvokerCallbackHandler callbackHandler) {}
-      public void setMBeanServer(MBeanServer server) {}
-      public void setInvoker(ServerInvoker invoker) {}
-   }
-   
-   static class TestCallbackHandler implements InvokerCallbackHandler
-   {
-      public int counter;
-      
-      public void handleCallback(Callback callback) throws HandleCallbackException
-      {
-         log.info(this + " received callback");
-         counter++;
-      }
-   }
-}
\ No newline at end of file

Copied: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java (from rev 6178, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java	                        (rev 0)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/bisocket/dos/DosTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -0,0 +1,392 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.transport.bisocket.dos;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+
+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.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.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.bisocket.Bisocket;
+import org.jboss.remoting.transport.bisocket.BisocketServerInvoker;
+
+import EDU.oswego.cs.dl.util.concurrent.Semaphore;
+
+/**
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Oct 13, 2010
+ * </p>
+ */
+public class DosTestCase extends TestCase
+{
+   private static final Logger log = Logger.getLogger(DosTestCase.class);
+   private static final String CALLBACK_TEST = "callbackTest";
+   private static final int dosMaxThreadsValue = 49;
+   private static final int dosTimeoutValue = 59;
+   
+   private static boolean firstTime = true;
+   
+   protected String host;
+   protected int port;
+   protected int secondaryPort;
+   protected String locatorURI;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected TestInvocationHandler invocationHandler;
+   protected Object lock = new Object();
+   protected boolean dosAttackThreadRan;
+   protected boolean secondCallbackRan;
+
+   
+   public void setUp() throws Exception
+   {
+      if (firstTime)
+      {
+         firstTime = false;
+         Logger.getLogger("org.jboss.remoting").setLevel(Level.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 testDosAttack() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer(false, false);
+      
+      // Create client.
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      addExtraClientConfig(clientConfig);
+      final Client client = new Client(serverLocator, clientConfig);
+      client.connect();
+      assertEquals("abc", client.invoke("abc"));
+      log.info("client is connected");
+      
+      // Add callback handler.
+      TestCallbackHandler callbackHandler = new TestCallbackHandler();
+      HashMap metadata = new HashMap();
+      metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+      client.addListener(callbackHandler, metadata);
+      client.invoke(CALLBACK_TEST);
+      assertEquals(1, callbackHandler.counter);
+      log.info("callback handler is installed");
+      
+      // Test DOS attack. 
+      new Thread()
+      {
+         public void run()
+         {
+            try
+            {
+               Socket s = new Socket(host, secondaryPort);
+               log.info(this + " created socket " + s);
+               synchronized (lock)
+               {
+                  dosAttackThreadRan = true;
+               } 
+            }
+            catch (IOException e)
+            {
+               log.error("unable to connect to secondaryPort: " + secondaryPort, e);
+            }
+            finally
+            {
+               synchronized (lock)
+               {
+                  lock.notifyAll();
+               }  
+            }
+         }
+      }.start();
+      
+      Thread.sleep(2000);
+      
+      synchronized (lock)
+      {
+         if (!dosAttackThreadRan)
+         {
+            long start = System.currentTimeMillis();
+            long end = start + 10000;
+            while (end - System.currentTimeMillis() > 0)
+            {
+               try
+               {
+                  lock.wait(end - System.currentTimeMillis());
+               }
+               catch (InterruptedException e){
+
+               }
+            }
+         }
+      } 
+      
+      if (!dosAttackThreadRan)
+      {
+         fail("DOS attack thread did not run");
+      }
+      
+      
+      // DOS attack has occurred.  Try to add another callback handler.
+      new Thread()
+      {
+         public void run()
+         {
+            TestCallbackHandler callbackHandler2 = new TestCallbackHandler();
+            try
+            {
+               
+               HashMap metadata = new HashMap();
+               metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+               client.addListener(callbackHandler2, metadata);
+               secondCallbackRan = true;
+               log.info(this + " second callback handler installed after DOS attack");
+            }
+            catch (Throwable e)
+            {
+               log.info(this + " second callback failed", e);
+            }    
+         }
+      }.start();
+      
+      Thread.sleep(10000);
+      assertTrue(secondCallbackRan);
+      
+      client.removeListener(callbackHandler);
+      client.disconnect();
+      connector.stop();
+   }
+   
+   
+   public void testConfigurationDefault() throws Throwable
+   {
+      log.info("entering " + getName());
+      doConfigurationTest(false, false, Bisocket.SECONDARY_MAX_THREADS_DEFAULT, Bisocket.SECONDARY_TIMEOUT_DEFAULT);
+      log.info(getName() + " PASSES");
+   }
+
+   
+   public void testConfigurationMap() throws Throwable
+   {
+      log.info("entering " + getName());
+      doConfigurationTest(true, false, dosMaxThreadsValue, dosTimeoutValue);
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   public void testConfigurationInvokerLocater() throws Throwable
+   {
+      log.info("entering " + getName());
+      doConfigurationTest(true, true, dosMaxThreadsValue, dosTimeoutValue);
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected void doConfigurationTest(boolean setParameters, boolean useInvokerLocator, int threadCount, int timeout) throws Throwable
+   {
+      // Start server.
+      setupServer(setParameters, useInvokerLocator);
+      
+      // Create client.
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      addExtraClientConfig(clientConfig);
+      final Client client = new Client(serverLocator, clientConfig);
+      client.connect();
+      assertEquals("abc", client.invoke("abc"));
+      log.info("client is connected");
+      
+      // Add callback handler.
+      TestCallbackHandler callbackHandler = new TestCallbackHandler();
+      HashMap metadata = new HashMap();
+      metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+      client.addListener(callbackHandler, metadata);
+      client.invoke(CALLBACK_TEST);
+      assertEquals(1, callbackHandler.counter);
+      log.info("callback handler is installed");
+      
+      BisocketServerInvoker invoker = (BisocketServerInvoker) connector.getServerInvoker();
+      assertEquals(threadCount, invoker.getDosMaxThreads());
+      assertEquals(timeout, invoker.getDosTimeout());
+      verifyThreadValues(invoker, threadCount, timeout);
+
+      client.removeListener(callbackHandler);
+      client.disconnect();
+      connector.stop();
+   }
+   
+   
+   protected boolean verifyThreadValues(ServerInvoker invoker, int threadCount, int timeout) throws Exception
+   {
+      Class[] classes = BisocketServerInvoker.class.getDeclaredClasses();
+      Class threadClass = null;
+      for (int i = 0; i < classes.length; i++)
+      {
+         if (classes[i].getName().indexOf("SecondaryServerSocketThread") > -1)
+         {
+            threadClass = classes[i];
+            break;
+         }
+      }
+      log.info("threadClass: " + threadClass);
+      Field field = BisocketServerInvoker.class.getDeclaredField("secondaryServerSocketThread");
+      field.setAccessible(true);
+      Thread secondaryServerSocketThread = (Thread) field.get(invoker);
+      Field maxThreads = threadClass.getDeclaredField("maxThreads");
+      maxThreads.setAccessible(true);
+      Field localDosTimeout = threadClass.getDeclaredField("localDosTimeout");
+      localDosTimeout.setAccessible(true);
+     
+      assertEquals(threadCount, ((Semaphore)maxThreads.get(secondaryServerSocketThread)).permits());
+      assertEquals(timeout, ((Integer)localDosTimeout.get(secondaryServerSocketThread)).intValue());
+      return true;
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "bisocket";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   protected void addExtraServerConfig(Map config) {}
+   
+
+   protected void setupServer(boolean setParameters, boolean useInvokerLocator) throws Exception
+   {
+      host = InetAddress.getLocalHost().getHostAddress();
+      port = PortUtil.findFreePort(host);
+      secondaryPort =  PortUtil.findFreePort(host);
+      locatorURI = getTransport() + "://" + host + ":" + port + "/?secondaryBindPort=" + secondaryPort;
+      String metadata = System.getProperty("remoting.metadata");
+      if (metadata != null)
+      {
+         locatorURI += "&" + metadata;
+      }
+      HashMap config = new HashMap();
+      config.put(InvokerLocator.FORCE_REMOTE, "true");
+      addExtraServerConfig(config);
+      if (setParameters)
+      {
+         if (useInvokerLocator)
+         {
+            locatorURI += "&" + Bisocket.SECONDARY_MAX_THREADS + "=" + Integer.toString(dosMaxThreadsValue);
+            locatorURI += "&" + Bisocket.SECONDARY_TIMEOUT + "=" + Integer.toString(dosTimeoutValue);
+         }
+         else
+         {
+            config.put(Bisocket.SECONDARY_MAX_THREADS, Integer.toString(dosMaxThreadsValue));
+            config.put(Bisocket.SECONDARY_TIMEOUT, Integer.toString(dosTimeoutValue));
+         }
+      }
+      serverLocator = new InvokerLocator(locatorURI);
+      log.info("Starting remoting server with locator uri of: " + locatorURI);
+      connector = new Connector(serverLocator, config);
+      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 Set listeners = new HashSet();
+      
+      public void addListener(InvokerCallbackHandler callbackHandler)
+      {
+         listeners.add(callbackHandler);
+      }
+      public Object invoke(final InvocationRequest invocation) throws Throwable
+      {
+         if (CALLBACK_TEST.equals(invocation.getParameter()))
+         {
+            Iterator it = listeners.iterator();
+            while (it.hasNext())
+            {
+               InvokerCallbackHandler handler = (InvokerCallbackHandler) it.next();
+               handler.handleCallback(new Callback("test"));
+               log.info(this + " sent callback");
+            }
+         }
+         return invocation.getParameter();
+      }
+      public void removeListener(InvokerCallbackHandler callbackHandler) {}
+      public void setMBeanServer(MBeanServer server) {}
+      public void setInvoker(ServerInvoker invoker) {}
+   }
+   
+   static class TestCallbackHandler implements InvokerCallbackHandler
+   {
+      public int counter;
+      
+      public void handleCallback(Callback callback) throws HandleCallbackException
+      {
+         log.info(this + " received callback");
+         counter++;
+      }
+   }
+}
\ No newline at end of file


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/ServletConfigurationMapTestClient.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/remoting-servlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/remoting-servlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/ssl/keystore
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/ssl/remoting-sslservlet-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/servlet/ssl/truststore
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Deleted: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java	2010-09-23 04:09:51 UTC (rev 6109)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -1,341 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, 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.transport.socket.retriable;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.net.SocketFactory;
-import javax.net.ssl.SSLException;
-
-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.Remoting;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.remoting.transport.PortUtil;
-
-
-/**
- * Unit test for JBREM-1245.
- * 
- * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Rev$
- * <p>
- * Copyright Sep 22, 2010
- * </p>
- */
-public class SocketGeneralizedExceptionTestCase extends TestCase
-{
-   private static Logger log = Logger.getLogger(SocketGeneralizedExceptionTestCase.class);
-   
-   private static boolean firstTime = true;
-   protected static IOException exceptionToThrow;
-   
-   protected String host;
-   protected int port;
-   protected String locatorURI;
-   protected InvokerLocator serverLocator;
-   protected Connector connector;
-   protected TestInvocationHandler invocationHandler;
-
-   
-   public void setUp() throws Exception
-   {
-      if (firstTime)
-      {
-         firstTime = false;
-         Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
-         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);  
-      }
-      
-      TestOutputStream.counter = 0;
-      TestOutputStream.threwException = false;
-   }
-
-   
-   public void tearDown()
-   {
-   }
-   
-   
-   public void testSSLException() throws Throwable
-   {
-      log.info("entering " + getName());
-      exceptionToThrow = new SSLException("Connection has been shutdown");
-      doTest();
-      log.info(getName() + " PASSES");
-   }
-   
-   
-   public void testConnectionResetException() throws Throwable
-   {
-      log.info("entering " + getName());
-      exceptionToThrow = new IOException("Connection reset by peer");
-      doTest();
-      log.info(getName() + " PASSES");
-   }
-   
-
-   public void testConnectionClosedException() throws Throwable
-   {
-      log.info("entering " + getName());
-      exceptionToThrow = new IOException("Connection is closed");
-      doTest();
-      log.info(getName() + " PASSES");
-   }
-   
-
-   public void testBrokenPipeException() throws Throwable
-   {
-      log.info("entering " + getName());
-      exceptionToThrow = new IOException("Broken pipe");
-      doTest();
-      log.info(getName() + " PASSES");
-   }
-   
-   
-   protected void doTest() throws Throwable
-   {
-      // Start server.
-      setupServer();
-      
-      // Create client.
-      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
-      HashMap clientConfig = new HashMap();
-      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
-      clientConfig.put(Remoting.CUSTOM_SOCKET_FACTORY, new TestSocketFactory(2));
-      addExtraClientConfig(clientConfig);
-      Client client = new Client(clientLocator, clientConfig);
-      client.connect();
-      log.info("client is connected");
-      
-      // Verify invocation works in spite of exception.
-      assertEquals("xyz", client.invoke("xyz"));
-      assertTrue(TestOutputStream.threwException);
-      
-      client.disconnect();
-      shutdownServer(); 
-   }
-   
-   
-   protected String getTransport()
-   {
-      return "socket";
-   }
-   
-   protected void addExtraServerConfig(Map config) {}
-   protected void addExtraClientConfig(Map config) {}
-   
-
-   protected void setupServer() throws Exception
-   {
-      host = InetAddress.getLocalHost().getHostAddress();
-      port = PortUtil.findFreePort(host);
-      locatorURI = getTransport() + "://" + host + ":" + port + "/?generalizeSocketException=true";
-      String metadata = System.getProperty("remoting.metadata");
-      if (metadata != null)
-      {
-         locatorURI += "&" + metadata;
-      }
-      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();
-   }
-   
-   
-   protected void shutdownServer() throws Exception
-   {
-      if (connector != null)
-         connector.stop();
-   }
-   
-   
-   static class TestInvocationHandler 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) {}
-   }
-   
-   
-   public static class TestSocketFactory extends SocketFactory
-   {
-      int initialSuccesses = 1;
-
-      public TestSocketFactory()
-      {
-      }
-      public TestSocketFactory(int initialSuccesses)
-      {
-         this.initialSuccesses = initialSuccesses;
-      }
-      public Socket createSocket()
-      {
-         Socket s = new TestSocket(initialSuccesses);
-         log.info("returning " + s);
-         return s;
-      }
-      public Socket createSocket(String arg0, int arg1) throws IOException, UnknownHostException
-      {
-         Socket s = new TestSocket(arg0, arg1, initialSuccesses);
-         log.info("returning " + s);
-         return s;
-      }
-
-      public Socket createSocket(InetAddress arg0, int arg1) throws IOException
-      {
-         Socket s = new TestSocket(arg0, arg1, initialSuccesses);
-         log.info("returning " + s);
-         return s;
-      }
-
-      public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) throws IOException, UnknownHostException
-      {
-         Socket s = new TestSocket(arg0, arg1, arg2, arg3, initialSuccesses);
-         log.info("returning " + s);
-         return s;
-      }
-
-      public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3) throws IOException
-      {
-         Socket s = new TestSocket(arg0, arg1, arg2, arg3, initialSuccesses);
-         log.info("returning " + s);
-         return s;
-      }
-   }
-   
-   
-   static class TestSocket extends Socket
-   {
-      int initialSuccesses;
-      
-      public TestSocket(int initialWrites)
-      {
-         this.initialSuccesses = initialWrites;
-      }
-      public TestSocket(String host, int port, int initialWrites) throws UnknownHostException, IOException
-      {
-         super(host, port);
-         this.initialSuccesses = initialWrites;
-      }
-      public TestSocket(InetAddress address, int port, int initialWrites) throws IOException
-      {
-         super(address, port);
-         this.initialSuccesses = initialWrites;
-      }
-      public TestSocket(String host, int port, InetAddress localAddr, int localPort, int initialWrites) throws IOException
-      {
-         super(host, port, localAddr, localPort);
-         this.initialSuccesses = initialWrites;
-      }
-      public TestSocket(InetAddress address, int port, InetAddress localAddr, int localPort, int initialWrites) throws IOException
-      {
-         super(address, port, localAddr, localPort);
-         this.initialSuccesses = initialWrites;
-      }
-      public OutputStream getOutputStream() throws IOException
-      {
-         return new TestOutputStream(super.getOutputStream(), initialSuccesses);
-      }
-      public String toString()
-      {
-         return "TestSocket[" + getLocalPort() + "->" + getPort() + "]";
-      }
-   }
-   
-   
-   static class TestOutputStream extends OutputStream
-   {
-      public static int counter;
-      public static boolean threwException;
-      
-      OutputStream os;
-      boolean closed;
-      int initialWrites;
-      boolean doThrow = true;
-      
-      public TestOutputStream(OutputStream os, int initialWrites)
-      {
-         this.os = os;
-         this.initialWrites = initialWrites;
-      }
-      public void write(int b) throws IOException
-      {
-         if (doThrow && ++counter == initialWrites)
-         {
-            log.info("throwing " + exceptionToThrow);
-            threwException = true;
-            throw exceptionToThrow;
-         }
-         os.write(b);
-      }
-      public void write(byte b[], int off, int len) throws IOException
-      {
-         log.info("TestOutputStream: counter = " + (counter + 1) + ", initialWrites = " + initialWrites);
-         if (++counter == initialWrites)
-         {
-            log.info("throwing " + exceptionToThrow);
-            threwException = true;
-            throw exceptionToThrow;
-         }
-         log.info(this + " calling write()");
-         doThrow = false;
-         os.write(b, off, len);
-         os.flush();
-         doThrow = true;
-         log.info(this + " back from write()");
-      }
-   }
-}
\ No newline at end of file

Copied: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java (from rev 6109, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java	                        (rev 0)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/transport/socket/retriable/SocketGeneralizedExceptionTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -0,0 +1,341 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.transport.socket.retriable;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.net.SocketFactory;
+import javax.net.ssl.SSLException;
+
+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.Remoting;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * Unit test for JBREM-1245.
+ * 
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Sep 22, 2010
+ * </p>
+ */
+public class SocketGeneralizedExceptionTestCase extends TestCase
+{
+   private static Logger log = Logger.getLogger(SocketGeneralizedExceptionTestCase.class);
+   
+   private static boolean firstTime = true;
+   protected static IOException exceptionToThrow;
+   
+   protected String host;
+   protected int port;
+   protected String locatorURI;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected TestInvocationHandler invocationHandler;
+
+   
+   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);  
+      }
+      
+      TestOutputStream.counter = 0;
+      TestOutputStream.threwException = false;
+   }
+
+   
+   public void tearDown()
+   {
+   }
+   
+   
+   public void testSSLException() throws Throwable
+   {
+      log.info("entering " + getName());
+      exceptionToThrow = new SSLException("Connection has been shutdown");
+      doTest();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   public void testConnectionResetException() throws Throwable
+   {
+      log.info("entering " + getName());
+      exceptionToThrow = new IOException("Connection reset by peer");
+      doTest();
+      log.info(getName() + " PASSES");
+   }
+   
+
+   public void testConnectionClosedException() throws Throwable
+   {
+      log.info("entering " + getName());
+      exceptionToThrow = new IOException("Connection is closed");
+      doTest();
+      log.info(getName() + " PASSES");
+   }
+   
+
+   public void testBrokenPipeException() throws Throwable
+   {
+      log.info("entering " + getName());
+      exceptionToThrow = new IOException("Broken pipe");
+      doTest();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected void doTest() throws Throwable
+   {
+      // Start server.
+      setupServer();
+      
+      // Create client.
+      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      clientConfig.put(Remoting.CUSTOM_SOCKET_FACTORY, new TestSocketFactory(2));
+      addExtraClientConfig(clientConfig);
+      Client client = new Client(clientLocator, clientConfig);
+      client.connect();
+      log.info("client is connected");
+      
+      // Verify invocation works in spite of exception.
+      assertEquals("xyz", client.invoke("xyz"));
+      assertTrue(TestOutputStream.threwException);
+      
+      client.disconnect();
+      shutdownServer(); 
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "socket";
+   }
+   
+   protected void addExtraServerConfig(Map config) {}
+   protected void addExtraClientConfig(Map config) {}
+   
+
+   protected void setupServer() throws Exception
+   {
+      host = InetAddress.getLocalHost().getHostAddress();
+      port = PortUtil.findFreePort(host);
+      locatorURI = getTransport() + "://" + host + ":" + port + "/?generalizeSocketException=true";
+      String metadata = System.getProperty("remoting.metadata");
+      if (metadata != null)
+      {
+         locatorURI += "&" + metadata;
+      }
+      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();
+   }
+   
+   
+   protected void shutdownServer() throws Exception
+   {
+      if (connector != null)
+         connector.stop();
+   }
+   
+   
+   static class TestInvocationHandler 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) {}
+   }
+   
+   
+   public static class TestSocketFactory extends SocketFactory
+   {
+      int initialSuccesses = 1;
+
+      public TestSocketFactory()
+      {
+      }
+      public TestSocketFactory(int initialSuccesses)
+      {
+         this.initialSuccesses = initialSuccesses;
+      }
+      public Socket createSocket()
+      {
+         Socket s = new TestSocket(initialSuccesses);
+         log.info("returning " + s);
+         return s;
+      }
+      public Socket createSocket(String arg0, int arg1) throws IOException, UnknownHostException
+      {
+         Socket s = new TestSocket(arg0, arg1, initialSuccesses);
+         log.info("returning " + s);
+         return s;
+      }
+
+      public Socket createSocket(InetAddress arg0, int arg1) throws IOException
+      {
+         Socket s = new TestSocket(arg0, arg1, initialSuccesses);
+         log.info("returning " + s);
+         return s;
+      }
+
+      public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) throws IOException, UnknownHostException
+      {
+         Socket s = new TestSocket(arg0, arg1, arg2, arg3, initialSuccesses);
+         log.info("returning " + s);
+         return s;
+      }
+
+      public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3) throws IOException
+      {
+         Socket s = new TestSocket(arg0, arg1, arg2, arg3, initialSuccesses);
+         log.info("returning " + s);
+         return s;
+      }
+   }
+   
+   
+   static class TestSocket extends Socket
+   {
+      int initialSuccesses;
+      
+      public TestSocket(int initialWrites)
+      {
+         this.initialSuccesses = initialWrites;
+      }
+      public TestSocket(String host, int port, int initialWrites) throws UnknownHostException, IOException
+      {
+         super(host, port);
+         this.initialSuccesses = initialWrites;
+      }
+      public TestSocket(InetAddress address, int port, int initialWrites) throws IOException
+      {
+         super(address, port);
+         this.initialSuccesses = initialWrites;
+      }
+      public TestSocket(String host, int port, InetAddress localAddr, int localPort, int initialWrites) throws IOException
+      {
+         super(host, port, localAddr, localPort);
+         this.initialSuccesses = initialWrites;
+      }
+      public TestSocket(InetAddress address, int port, InetAddress localAddr, int localPort, int initialWrites) throws IOException
+      {
+         super(address, port, localAddr, localPort);
+         this.initialSuccesses = initialWrites;
+      }
+      public OutputStream getOutputStream() throws IOException
+      {
+         return new TestOutputStream(super.getOutputStream(), initialSuccesses);
+      }
+      public String toString()
+      {
+         return "TestSocket[" + getLocalPort() + "->" + getPort() + "]";
+      }
+   }
+   
+   
+   static class TestOutputStream extends OutputStream
+   {
+      public static int counter;
+      public static boolean threwException;
+      
+      OutputStream os;
+      boolean closed;
+      int initialWrites;
+      boolean doThrow = true;
+      
+      public TestOutputStream(OutputStream os, int initialWrites)
+      {
+         this.os = os;
+         this.initialWrites = initialWrites;
+      }
+      public void write(int b) throws IOException
+      {
+         if (doThrow && ++counter == initialWrites)
+         {
+            log.info("throwing " + exceptionToThrow);
+            threwException = true;
+            throw exceptionToThrow;
+         }
+         os.write(b);
+      }
+      public void write(byte b[], int off, int len) throws IOException
+      {
+         log.info("TestOutputStream: counter = " + (counter + 1) + ", initialWrites = " + initialWrites);
+         if (++counter == initialWrites)
+         {
+            log.info("throwing " + exceptionToThrow);
+            threwException = true;
+            throw exceptionToThrow;
+         }
+         log.info(this + " calling write()");
+         doThrow = false;
+         os.write(b, off, len);
+         os.flush();
+         doThrow = true;
+         log.info(this + " back from write()");
+      }
+   }
+}
\ No newline at end of file

Deleted: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityVersionTestServer.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityVersionTestServer.java	2010-12-15 23:26:35 UTC (rev 6174)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityVersionTestServer.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -1,221 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, 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.versioning.identity;
-
-import java.lang.reflect.Field;
-import java.net.InetAddress;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.MBeanServer;
-
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.jboss.jrunit.extensions.ServerTestCase;
-import org.jboss.logging.XLevel;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.ConnectionListener;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.Remoting;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.remoting.transport.socket.LRUPool;
-import org.jboss.remoting.transport.socket.ServerSocketWrapper;
-import org.jboss.remoting.transport.socket.ServerThread;
-import org.jboss.remoting.transport.socket.SocketServerInvoker;
-
-
-/**
- * Versioning tests for JBREM-1144.
- * 
- * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Rev$
- * <p>
- * Copyright Nov 17, 2010
- * </p>
- */
-public class ServerIdentityVersionTestServer extends ServerTestCase
-{
-   public static int PORT = 6543;
-
-   private static Logger log = Logger.getLogger(ServerIdentityVersionTestServer.class);
-
-   protected String host;
-   protected int port;
-   protected InvokerLocator serverLocator;
-   protected Connector connector;
-   protected TestInvocationHandler invocationHandler;
-
-   public static void main(String[] args)
-   {
-      try
-      {
-         final ServerIdentityVersionTestServer p = new ServerIdentityVersionTestServer();
-         Thread.sleep(300000);
-         p.tearDown();
-      }
-      catch (Exception e)
-      {
-         log.error("Error", e);
-      }
-   }
-
-   public void setUp() throws Exception
-   {
-      new Thread()
-      {
-         public void run()
-         {
-            try
-            {
-               Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
-               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);
-
-               host = InetAddress.getLocalHost().getHostAddress();
-
-               // Start server.
-               setupServer(true);
-
-               // Allow time to get serverId of first server.
-               Thread.sleep(15000);
-
-               // Bounce server.
-               shutdownServer();
-               log.info("SHUT DOWN SERVER");
-               setupServer(true);
-               log.info("SET UP NEW SERVER");
-
-               Thread.sleep(15000);
-               shutdownServer();
-            }
-            catch (Exception e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }.start();
-   }
-
-
-   public void tearDown() throws Exception
-   {
-   }
-
-
-   protected String getTransport()
-   {
-      return "socket";
-   }
-
-
-   protected void addExtraServerConfig(Map config) {}
-
-
-   protected void setupServer(boolean useLeasing) throws Exception
-   {
-      String locatorURI = getTransport() + "://" + host + ":" + PORT + "/?" + Remoting.USE_SERVER_CONNECTION_IDENTITY + "=true";
-      if (useLeasing)
-      {
-         locatorURI += "&" + InvokerLocator.CLIENT_LEASE + "=true";
-         locatorURI += "&" + InvokerLocator.CLIENT_LEASE_PERIOD + "=20000";
-      }
-      String metadata = System.getProperty("remoting.metadata");
-      if (metadata != null)
-      {
-         locatorURI += "&" + metadata;
-      }
-      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);
-      if (useLeasing)
-      {
-         connector.addConnectionListener(new TestConnectionListener());
-      }
-      connector.start();
-   }
-
-
-   protected void shutdownServer() throws Exception
-   {
-      if (connector != null)
-      {
-         SocketServerInvoker invoker = (SocketServerInvoker) connector.getServerInvoker();
-         Field clientpoolField = SocketServerInvoker.class.getDeclaredField("clientpool");
-         clientpoolField.setAccessible(true);
-         Field socketWrapperField = ServerThread.class.getDeclaredField("socketWrapper");
-         socketWrapperField.setAccessible(true);
-         LRUPool clientpool = (LRUPool) clientpoolField.get(invoker);
-         Set threads = clientpool.getContents();
-         Iterator it = threads.iterator();
-         while (it.hasNext())
-         {
-            ServerThread t = (ServerThread) it.next();
-            ServerSocketWrapper socketWrapper = (ServerSocketWrapper) socketWrapperField.get(t);
-            socketWrapper.close();
-         }
-         connector.stop();
-      }
-   }
-
-
-   static class TestInvocationHandler 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) {}
-   }
-
-   static class TestConnectionListener implements ConnectionListener
-   {
-      public boolean connectionFailed;
-      public Throwable throwable;
-
-      public void handleConnectionException(Throwable throwable, Client client)
-      {
-         connectionFailed = true;
-         this.throwable = throwable;
-         log.info(this + " received connection notification: connectionFailed: " + connectionFailed);
-      }
-   }
-}
\ No newline at end of file

Copied: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityVersionTestServer.java (from rev 6174, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityVersionTestServer.java)
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityVersionTestServer.java	                        (rev 0)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityVersionTestServer.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -0,0 +1,221 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.versioning.identity;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.jrunit.extensions.ServerTestCase;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.ConnectionListener;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Remoting;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.socket.LRUPool;
+import org.jboss.remoting.transport.socket.ServerSocketWrapper;
+import org.jboss.remoting.transport.socket.ServerThread;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
+
+
+/**
+ * Versioning tests for JBREM-1144.
+ * 
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Nov 17, 2010
+ * </p>
+ */
+public class ServerIdentityVersionTestServer extends ServerTestCase
+{
+   public static int PORT = 6543;
+
+   private static Logger log = Logger.getLogger(ServerIdentityVersionTestServer.class);
+
+   protected String host;
+   protected int port;
+   protected InvokerLocator serverLocator;
+   protected Connector connector;
+   protected TestInvocationHandler invocationHandler;
+
+   public static void main(String[] args)
+   {
+      try
+      {
+         final ServerIdentityVersionTestServer p = new ServerIdentityVersionTestServer();
+         Thread.sleep(300000);
+         p.tearDown();
+      }
+      catch (Exception e)
+      {
+         log.error("Error", e);
+      }
+   }
+
+   public void setUp() throws Exception
+   {
+      new Thread()
+      {
+         public void run()
+         {
+            try
+            {
+               Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
+               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);
+
+               host = InetAddress.getLocalHost().getHostAddress();
+
+               // Start server.
+               setupServer(true);
+
+               // Allow time to get serverId of first server.
+               Thread.sleep(15000);
+
+               // Bounce server.
+               shutdownServer();
+               log.info("SHUT DOWN SERVER");
+               setupServer(true);
+               log.info("SET UP NEW SERVER");
+
+               Thread.sleep(15000);
+               shutdownServer();
+            }
+            catch (Exception e)
+            {
+               e.printStackTrace();
+            }
+         }
+      }.start();
+   }
+
+
+   public void tearDown() throws Exception
+   {
+   }
+
+
+   protected String getTransport()
+   {
+      return "socket";
+   }
+
+
+   protected void addExtraServerConfig(Map config) {}
+
+
+   protected void setupServer(boolean useLeasing) throws Exception
+   {
+      String locatorURI = getTransport() + "://" + host + ":" + PORT + "/?" + Remoting.USE_SERVER_CONNECTION_IDENTITY + "=true";
+      if (useLeasing)
+      {
+         locatorURI += "&" + InvokerLocator.CLIENT_LEASE + "=true";
+         locatorURI += "&" + InvokerLocator.CLIENT_LEASE_PERIOD + "=20000";
+      }
+      String metadata = System.getProperty("remoting.metadata");
+      if (metadata != null)
+      {
+         locatorURI += "&" + metadata;
+      }
+      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);
+      if (useLeasing)
+      {
+         connector.addConnectionListener(new TestConnectionListener());
+      }
+      connector.start();
+   }
+
+
+   protected void shutdownServer() throws Exception
+   {
+      if (connector != null)
+      {
+         SocketServerInvoker invoker = (SocketServerInvoker) connector.getServerInvoker();
+         Field clientpoolField = SocketServerInvoker.class.getDeclaredField("clientpool");
+         clientpoolField.setAccessible(true);
+         Field socketWrapperField = ServerThread.class.getDeclaredField("socketWrapper");
+         socketWrapperField.setAccessible(true);
+         LRUPool clientpool = (LRUPool) clientpoolField.get(invoker);
+         Set threads = clientpool.getContents();
+         Iterator it = threads.iterator();
+         while (it.hasNext())
+         {
+            ServerThread t = (ServerThread) it.next();
+            ServerSocketWrapper socketWrapper = (ServerSocketWrapper) socketWrapperField.get(t);
+            socketWrapper.close();
+         }
+         connector.stop();
+      }
+   }
+
+
+   static class TestInvocationHandler 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) {}
+   }
+
+   static class TestConnectionListener implements ConnectionListener
+   {
+      public boolean connectionFailed;
+      public Throwable throwable;
+
+      public void handleConnectionException(Throwable throwable, Client client)
+      {
+         connectionFailed = true;
+         this.throwable = throwable;
+         log.info(this + " received connection notification: connectionFailed: " + connectionFailed);
+      }
+   }
+}
\ No newline at end of file

Deleted: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestCase.java	2010-12-15 23:26:35 UTC (rev 6174)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -1,169 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2010, 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.versioning.identity;
-
-import org.apache.log4j.Level;
-import org.jboss.test.remoting.transport.InvokerTestDriver;
-
-/**
- * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Rev$
- * <p>
- * Copyright Nov 29, 2010
- * </p>
- */
-public class ServerIdentityWithLeasingVersionTestCase extends InvokerTestDriver
-{
-   public void declareTestClasses()
-   {
-      addTestClasses("org.jboss.test.remoting.versioning.identity.ServerIdentityWithLeasingVersionTestClient",
-                     1,
-                     "org.jboss.test.remoting.versioning.identity.ServerIdentityVersionTestServer");
-   }
-   
-   /**
-    * Returns the classpath to be added to the classpath used to start the client tests.
-    * Default return is null, which means no extra classpath will be added.
-    *
-    * @return
-    */
-   protected String getExtendedServerClasspath()
-   {
-      return System.getProperty("server.path");
-   }
-
-   /**
-    * Returns the classpath to be added to the classpath used to start the client tests.
-    * Default return is null, which means no extra classpath will be added.
-    *
-    * @return
-    */
-   protected String getExtendedClientClasspath()
-   {
-      return System.getProperty("client.path");
-   }
-   
-   protected String getClientJVMArguments()
-   {
-      String prop = System.getProperty("client.pre_2_0_compatible");
-      String args = "";
-      if (prop != null && !"".equals(prop))
-      {
-         args = "-Djboss.remoting.pre_2_0_compatible=" + prop;
-      }
-      else
-      {
-         prop = System.getProperty("client.version");
-         if (prop != null && !"".equals(prop))
-            args = "-Djboss.remoting.version=" + prop;
-      }
-      prop = System.getProperty("client.check_connection");
-      if (prop != null && !"".equals(prop))
-      {
-         args += " -Dremoting.metadata=socket.check_connection=" + prop;
-      }
-      System.out.println("client arg: " + args);
-      return args;
-   }
-
-
-   protected String getServerJVMArguments()
-   {
-      String prop = System.getProperty("server.pre_2_0_compatible");
-      String args = "";
-      if (prop != null && !"".equals(prop))
-      {
-         args = "-Djboss.remoting.pre_2_0_compatible=" + prop;
-      }
-      else
-      {
-         prop = System.getProperty("server.version");
-         if (prop != null && !"".equals(prop))
-            args = "-Djboss.remoting.version=" + prop;
-      }
-      prop = System.getProperty("server.check_connection");
-      if (prop != null && !"".equals(prop))
-      {
-         args += " -Dremoting.metadata=socket.check_connection=" + prop;
-      }
-      prop = System.getProperty("clientImplementsServerIdentity");
-      if (prop != null && !"".equals(prop))
-      {
-         args += " -DclientImplementsServerIdentity=" + prop;
-      }
-      prop = System.getProperty("serverImplementsServerIdentity");
-      if (prop != null && !"".equals(prop))
-      {
-         args += " -DserverImplementsServerIdentity=" + prop;
-      }
-      System.out.println("server arg: " + args);
-      return args;
-   }
-   
-
-   protected Level getTestHarnessLogLevel()
-   {
-      return Level.INFO;
-   }
-
-   protected Level getTestLogLevel()
-   {
-      return Level.INFO;
-   }
-
-   /**
-    * How long to wait for test results to be returned from the client(s).  If goes longer than the
-    * specified limit, will throw an exception and kill the running test cases.  Default value is
-    * RESULTS_TIMEOUT.
-    *
-    * @return
-    */
-   protected long getResultsTimeout()
-   {
-      return 60000;
-   }
-
-   /**
-    * How long for the server test case to wait for tear down message.  If exceeds timeout,
-    * will throw exception.  The default value is TEARDOWN_TIMEOUT.
-    *
-    * @return
-    */
-   protected long getTearDownTimeout()
-   {
-      return 60000;
-   }
-
-   /**
-    * How long to allow each of the test cases to run their tests.  If exceeds this timeout
-    * will throw exception and kill tests.  The default value is RUN_TEST_TIMEOUT.
-    *
-    * @return
-    */
-   protected long getRunTestTimeout()
-   {
-      return 60000;
-   }
-
-
-}

Copied: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestCase.java (from rev 6174, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestCase.java	                        (rev 0)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -0,0 +1,169 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, 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.versioning.identity;
+
+import org.apache.log4j.Level;
+import org.jboss.test.remoting.transport.InvokerTestDriver;
+
+/**
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Nov 29, 2010
+ * </p>
+ */
+public class ServerIdentityWithLeasingVersionTestCase extends InvokerTestDriver
+{
+   public void declareTestClasses()
+   {
+      addTestClasses("org.jboss.test.remoting.versioning.identity.ServerIdentityWithLeasingVersionTestClient",
+                     1,
+                     "org.jboss.test.remoting.versioning.identity.ServerIdentityVersionTestServer");
+   }
+   
+   /**
+    * Returns the classpath to be added to the classpath used to start the client tests.
+    * Default return is null, which means no extra classpath will be added.
+    *
+    * @return
+    */
+   protected String getExtendedServerClasspath()
+   {
+      return System.getProperty("server.path");
+   }
+
+   /**
+    * Returns the classpath to be added to the classpath used to start the client tests.
+    * Default return is null, which means no extra classpath will be added.
+    *
+    * @return
+    */
+   protected String getExtendedClientClasspath()
+   {
+      return System.getProperty("client.path");
+   }
+   
+   protected String getClientJVMArguments()
+   {
+      String prop = System.getProperty("client.pre_2_0_compatible");
+      String args = "";
+      if (prop != null && !"".equals(prop))
+      {
+         args = "-Djboss.remoting.pre_2_0_compatible=" + prop;
+      }
+      else
+      {
+         prop = System.getProperty("client.version");
+         if (prop != null && !"".equals(prop))
+            args = "-Djboss.remoting.version=" + prop;
+      }
+      prop = System.getProperty("client.check_connection");
+      if (prop != null && !"".equals(prop))
+      {
+         args += " -Dremoting.metadata=socket.check_connection=" + prop;
+      }
+      System.out.println("client arg: " + args);
+      return args;
+   }
+
+
+   protected String getServerJVMArguments()
+   {
+      String prop = System.getProperty("server.pre_2_0_compatible");
+      String args = "";
+      if (prop != null && !"".equals(prop))
+      {
+         args = "-Djboss.remoting.pre_2_0_compatible=" + prop;
+      }
+      else
+      {
+         prop = System.getProperty("server.version");
+         if (prop != null && !"".equals(prop))
+            args = "-Djboss.remoting.version=" + prop;
+      }
+      prop = System.getProperty("server.check_connection");
+      if (prop != null && !"".equals(prop))
+      {
+         args += " -Dremoting.metadata=socket.check_connection=" + prop;
+      }
+      prop = System.getProperty("clientImplementsServerIdentity");
+      if (prop != null && !"".equals(prop))
+      {
+         args += " -DclientImplementsServerIdentity=" + prop;
+      }
+      prop = System.getProperty("serverImplementsServerIdentity");
+      if (prop != null && !"".equals(prop))
+      {
+         args += " -DserverImplementsServerIdentity=" + prop;
+      }
+      System.out.println("server arg: " + args);
+      return args;
+   }
+   
+
+   protected Level getTestHarnessLogLevel()
+   {
+      return Level.INFO;
+   }
+
+   protected Level getTestLogLevel()
+   {
+      return Level.INFO;
+   }
+
+   /**
+    * How long to wait for test results to be returned from the client(s).  If goes longer than the
+    * specified limit, will throw an exception and kill the running test cases.  Default value is
+    * RESULTS_TIMEOUT.
+    *
+    * @return
+    */
+   protected long getResultsTimeout()
+   {
+      return 60000;
+   }
+
+   /**
+    * How long for the server test case to wait for tear down message.  If exceeds timeout,
+    * will throw exception.  The default value is TEARDOWN_TIMEOUT.
+    *
+    * @return
+    */
+   protected long getTearDownTimeout()
+   {
+      return 60000;
+   }
+
+   /**
+    * How long to allow each of the test cases to run their tests.  If exceeds this timeout
+    * will throw exception and kill tests.  The default value is RUN_TEST_TIMEOUT.
+    *
+    * @return
+    */
+   protected long getRunTestTimeout()
+   {
+      return 60000;
+   }
+
+
+}

Deleted: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestClient.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestClient.java	2010-12-15 23:26:35 UTC (rev 6174)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestClient.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -1,223 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2010, 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.versioning.identity;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-
-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.ConnectionListener;
-import org.jboss.remoting.ConnectionValidator;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.Remoting;
-
-
-/**
- * Versioning Unit tests for JBREM-1144.
- * 
- * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Rev$
- * <p>
- * Copyright Nov 17, 2010
- * </p>
- */
-public class ServerIdentityWithLeasingVersionTestClient extends TestCase
-{
-   private static Logger log = Logger.getLogger(ServerIdentityWithLeasingVersionTestClient.class);
-   private String host;
-   private boolean clientImplementsServerIdentity;
-   private boolean serverImplementsServerIdentity;
-   protected ByteArrayOutputStream baosOut;
-   protected PrintStream originalOutPrintStream;
-   protected ByteArrayOutputStream baosErr;
-   protected PrintStream originalErrPrintStream;
-   
-   public void setUp() throws Exception
-   {
-      clientImplementsServerIdentity = Boolean.getBoolean("clientImplementsServerIdentity");
-      serverImplementsServerIdentity = Boolean.getBoolean("serverImplementsServerIdentity");
-      host = InetAddress.getLocalHost().getHostAddress();
-
-      if (clientImplementsServerIdentity && serverImplementsServerIdentity)
-      {
-         originalOutPrintStream = System.out;
-         baosOut = new ByteArrayOutputStream();
-         PrintStream ps = new PrintStream(baosOut);
-         System.setOut(ps);
-         
-         originalErrPrintStream = System.err;
-         baosErr = new ByteArrayOutputStream();
-         ps = new PrintStream(baosErr);
-         System.setErr(ps);
-      }
-      
-      Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
-      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);
-
-      log.info(this + " clientImplementsServerIdentity: " + clientImplementsServerIdentity);
-      log.info(this + " serverImplementsServerIdentity: " + serverImplementsServerIdentity);  
-      log.info(this + " host: " + host);
-   }
-
-   
-   public void tearDown()
-   {
-   }
-   
-   
-   public void testServerIdentityWithLeasing() throws Throwable
-   {
-      log.info("entering " + getName());
-      
-      InvokerLocator clientLocator = new InvokerLocator(createLocatorURI());
-      log.info(this + "clientLocator: " + clientLocator);
-      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 connection.
-      assertEquals("abc", client.invoke("abc"));
-      log.info("connection is good");
-      
-      // Run appropriate test.
-      if (clientImplementsServerIdentity && serverImplementsServerIdentity)
-      {
-         assertTrue(doServerIdentitySupportedTest(client));
-      }
-      else
-      {
-         assertTrue(doServerIdentityUnsupportedTest(client));
-      }
-
-      client.disconnect();
-      log.info(getName() + " PASSES");
-   }
-   
-   
-   protected String getTransport()
-   {
-      return "socket";
-   }
-   
-   
-   protected void addExtraClientConfig(Map config) {}
-   
-
-   protected String createLocatorURI() throws UnknownHostException
-   {
-      String locatorURI = getTransport() + "://" + host + ":" + ServerIdentityVersionTestServer.PORT + "/?" + Remoting.USE_SERVER_CONNECTION_IDENTITY + "=true";
-      locatorURI += "&" + InvokerLocator.CLIENT_LEASE + "=true";
-      locatorURI += "&" + InvokerLocator.CLIENT_LEASE_PERIOD + "=20000";
-      String metadata = System.getProperty("remoting.metadata");
-      if (metadata != null)
-      {
-         locatorURI += "&" + metadata;
-      }
-      return locatorURI;
-   }
-   
-   
-   protected boolean doServerIdentitySupportedTest(Client client) throws Exception
-   {
-      log.info("running server identity supported test");
-      
-      // Install connection listener.
-      TestConnectionListener listener = new TestConnectionListener();
-      HashMap metadata = new HashMap();
-      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
-      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "10000");
-      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "10000");
-      client.addConnectionListener(listener, metadata);
-      log.info(this + " added connection listener: " + listener);
-      
-      // Allow time to get serverId of first server.
-      Thread.sleep(15000);
-      
-      // Verify listener is notified if server bounces (assuming the server identity
-      // facility is available.
-      Thread.sleep(10000);
-      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
-      
-      System.setOut(originalOutPrintStream);
-      String sOut = new String(baosOut.toByteArray());
-      System.out.println(sOut);
-      System.setErr(originalErrPrintStream);
-      String sErr = new String(baosErr.toByteArray());
-      System.out.println(sErr);
-      
-      return listener.connectionFailed && (sOut.indexOf("detected new serverId:") > -1 || sErr.indexOf("detected new serverId:") > -1);
-
-   }
-   
-   
-   protected boolean doServerIdentityUnsupportedTest(Client client) throws Exception
-   {
-      log.info("running server identity unsupported test");
-      
-      // Install connection listener.
-      TestConnectionListener listener = new TestConnectionListener();
-      HashMap metadata = new HashMap();
-      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
-      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "1000");
-      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "1000");
-      client.addConnectionListener(listener, metadata);
-      log.info(this + " added connection listener: " + listener);
-      
-      // Allow ConnectionValidator to run for a while.
-      Thread.sleep(10000);
-      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
-      return !listener.connectionFailed;
-   }
-   
-   
-   static class TestConnectionListener implements ConnectionListener
-   {
-      public boolean connectionFailed;
-      public Throwable throwable;
-      
-      public void handleConnectionException(Throwable throwable, Client client)
-      {
-         connectionFailed = true;
-         this.throwable = throwable;
-         log.info(this + " received connection notification: connectionFailed: " + connectionFailed);
-      }
-      
-   }
-}
\ No newline at end of file

Copied: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestClient.java (from rev 6174, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestClient.java)
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestClient.java	                        (rev 0)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithLeasingVersionTestClient.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -0,0 +1,223 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, 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.versioning.identity;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+
+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.ConnectionListener;
+import org.jboss.remoting.ConnectionValidator;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Remoting;
+
+
+/**
+ * Versioning Unit tests for JBREM-1144.
+ * 
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Nov 17, 2010
+ * </p>
+ */
+public class ServerIdentityWithLeasingVersionTestClient extends TestCase
+{
+   private static Logger log = Logger.getLogger(ServerIdentityWithLeasingVersionTestClient.class);
+   private String host;
+   private boolean clientImplementsServerIdentity;
+   private boolean serverImplementsServerIdentity;
+   protected ByteArrayOutputStream baosOut;
+   protected PrintStream originalOutPrintStream;
+   protected ByteArrayOutputStream baosErr;
+   protected PrintStream originalErrPrintStream;
+   
+   public void setUp() throws Exception
+   {
+      clientImplementsServerIdentity = Boolean.getBoolean("clientImplementsServerIdentity");
+      serverImplementsServerIdentity = Boolean.getBoolean("serverImplementsServerIdentity");
+      host = InetAddress.getLocalHost().getHostAddress();
+
+      if (clientImplementsServerIdentity && serverImplementsServerIdentity)
+      {
+         originalOutPrintStream = System.out;
+         baosOut = new ByteArrayOutputStream();
+         PrintStream ps = new PrintStream(baosOut);
+         System.setOut(ps);
+         
+         originalErrPrintStream = System.err;
+         baosErr = new ByteArrayOutputStream();
+         ps = new PrintStream(baosErr);
+         System.setErr(ps);
+      }
+      
+      Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
+      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);
+
+      log.info(this + " clientImplementsServerIdentity: " + clientImplementsServerIdentity);
+      log.info(this + " serverImplementsServerIdentity: " + serverImplementsServerIdentity);  
+      log.info(this + " host: " + host);
+   }
+
+   
+   public void tearDown()
+   {
+   }
+   
+   
+   public void testServerIdentityWithLeasing() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      InvokerLocator clientLocator = new InvokerLocator(createLocatorURI());
+      log.info(this + "clientLocator: " + clientLocator);
+      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 connection.
+      assertEquals("abc", client.invoke("abc"));
+      log.info("connection is good");
+      
+      // Run appropriate test.
+      if (clientImplementsServerIdentity && serverImplementsServerIdentity)
+      {
+         assertTrue(doServerIdentitySupportedTest(client));
+      }
+      else
+      {
+         assertTrue(doServerIdentityUnsupportedTest(client));
+      }
+
+      client.disconnect();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "socket";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   
+
+   protected String createLocatorURI() throws UnknownHostException
+   {
+      String locatorURI = getTransport() + "://" + host + ":" + ServerIdentityVersionTestServer.PORT + "/?" + Remoting.USE_SERVER_CONNECTION_IDENTITY + "=true";
+      locatorURI += "&" + InvokerLocator.CLIENT_LEASE + "=true";
+      locatorURI += "&" + InvokerLocator.CLIENT_LEASE_PERIOD + "=20000";
+      String metadata = System.getProperty("remoting.metadata");
+      if (metadata != null)
+      {
+         locatorURI += "&" + metadata;
+      }
+      return locatorURI;
+   }
+   
+   
+   protected boolean doServerIdentitySupportedTest(Client client) throws Exception
+   {
+      log.info("running server identity supported test");
+      
+      // Install connection listener.
+      TestConnectionListener listener = new TestConnectionListener();
+      HashMap metadata = new HashMap();
+      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "10000");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "10000");
+      client.addConnectionListener(listener, metadata);
+      log.info(this + " added connection listener: " + listener);
+      
+      // Allow time to get serverId of first server.
+      Thread.sleep(15000);
+      
+      // Verify listener is notified if server bounces (assuming the server identity
+      // facility is available.
+      Thread.sleep(10000);
+      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
+      
+      System.setOut(originalOutPrintStream);
+      String sOut = new String(baosOut.toByteArray());
+      System.out.println(sOut);
+      System.setErr(originalErrPrintStream);
+      String sErr = new String(baosErr.toByteArray());
+      System.out.println(sErr);
+      
+      return listener.connectionFailed && (sOut.indexOf("detected new serverId:") > -1 || sErr.indexOf("detected new serverId:") > -1);
+
+   }
+   
+   
+   protected boolean doServerIdentityUnsupportedTest(Client client) throws Exception
+   {
+      log.info("running server identity unsupported test");
+      
+      // Install connection listener.
+      TestConnectionListener listener = new TestConnectionListener();
+      HashMap metadata = new HashMap();
+      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "1000");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "1000");
+      client.addConnectionListener(listener, metadata);
+      log.info(this + " added connection listener: " + listener);
+      
+      // Allow ConnectionValidator to run for a while.
+      Thread.sleep(10000);
+      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
+      return !listener.connectionFailed;
+   }
+   
+   
+   static class TestConnectionListener implements ConnectionListener
+   {
+      public boolean connectionFailed;
+      public Throwable throwable;
+      
+      public void handleConnectionException(Throwable throwable, Client client)
+      {
+         connectionFailed = true;
+         this.throwable = throwable;
+         log.info(this + " received connection notification: connectionFailed: " + connectionFailed);
+      }
+      
+   }
+}
\ No newline at end of file

Deleted: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestCase.java	2010-12-15 23:26:35 UTC (rev 6174)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -1,169 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2010, 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.versioning.identity;
-
-import org.apache.log4j.Level;
-import org.jboss.test.remoting.transport.InvokerTestDriver;
-
-/**
- * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Rev$
- * <p>
- * Copyright Nov 29, 2010
- * </p>
- */
-public class ServerIdentityWithoutLeasingVersionTestCase extends InvokerTestDriver
-{
-   public void declareTestClasses()
-   {
-      addTestClasses("org.jboss.test.remoting.versioning.identity.ServerIdentityWithoutLeasingVersionTestClient",
-                     1,
-                     "org.jboss.test.remoting.versioning.identity.ServerIdentityVersionTestServer");
-   }
-   
-   /**
-    * Returns the classpath to be added to the classpath used to start the client tests.
-    * Default return is null, which means no extra classpath will be added.
-    *
-    * @return
-    */
-   protected String getExtendedServerClasspath()
-   {
-      return System.getProperty("server.path");
-   }
-
-   /**
-    * Returns the classpath to be added to the classpath used to start the client tests.
-    * Default return is null, which means no extra classpath will be added.
-    *
-    * @return
-    */
-   protected String getExtendedClientClasspath()
-   {
-      return System.getProperty("client.path");
-   }
-   
-   protected String getClientJVMArguments()
-   {
-      String prop = System.getProperty("client.pre_2_0_compatible");
-      String args = "";
-      if (prop != null && !"".equals(prop))
-      {
-         args = "-Djboss.remoting.pre_2_0_compatible=" + prop;
-      }
-      else
-      {
-         prop = System.getProperty("client.version");
-         if (prop != null && !"".equals(prop))
-            args = "-Djboss.remoting.version=" + prop;
-      }
-      prop = System.getProperty("client.check_connection");
-      if (prop != null && !"".equals(prop))
-      {
-         args += " -Dremoting.metadata=socket.check_connection=" + prop;
-      }
-      System.out.println("client arg: " + args);
-      return args;
-   }
-
-
-   protected String getServerJVMArguments()
-   {
-      String prop = System.getProperty("server.pre_2_0_compatible");
-      String args = "";
-      if (prop != null && !"".equals(prop))
-      {
-         args = "-Djboss.remoting.pre_2_0_compatible=" + prop;
-      }
-      else
-      {
-         prop = System.getProperty("server.version");
-         if (prop != null && !"".equals(prop))
-            args = "-Djboss.remoting.version=" + prop;
-      }
-      prop = System.getProperty("server.check_connection");
-      if (prop != null && !"".equals(prop))
-      {
-         args += " -Dremoting.metadata=socket.check_connection=" + prop;
-      }
-      prop = System.getProperty("clientImplementsServerIdentity");
-      if (prop != null && !"".equals(prop))
-      {
-         args += " -DclientImplementsServerIdentity=" + prop;
-      }
-      prop = System.getProperty("serverImplementsServerIdentity");
-      if (prop != null && !"".equals(prop))
-      {
-         args += " -DserverImplementsServerIdentity=" + prop;
-      }
-      System.out.println("server arg: " + args);
-      return args;
-   }
-   
-
-   protected Level getTestHarnessLogLevel()
-   {
-      return Level.INFO;
-   }
-
-   protected Level getTestLogLevel()
-   {
-      return Level.INFO;
-   }
-
-   /**
-    * How long to wait for test results to be returned from the client(s).  If goes longer than the
-    * specified limit, will throw an exception and kill the running test cases.  Default value is
-    * RESULTS_TIMEOUT.
-    *
-    * @return
-    */
-   protected long getResultsTimeout()
-   {
-      return 60000;
-   }
-
-   /**
-    * How long for the server test case to wait for tear down message.  If exceeds timeout,
-    * will throw exception.  The default value is TEARDOWN_TIMEOUT.
-    *
-    * @return
-    */
-   protected long getTearDownTimeout()
-   {
-      return 60000;
-   }
-
-   /**
-    * How long to allow each of the test cases to run their tests.  If exceeds this timeout
-    * will throw exception and kill tests.  The default value is RUN_TEST_TIMEOUT.
-    *
-    * @return
-    */
-   protected long getRunTestTimeout()
-   {
-      return 60000;
-   }
-
-
-}

Copied: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestCase.java (from rev 6174, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestCase.java)
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestCase.java	                        (rev 0)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestCase.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -0,0 +1,169 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, 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.versioning.identity;
+
+import org.apache.log4j.Level;
+import org.jboss.test.remoting.transport.InvokerTestDriver;
+
+/**
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Nov 29, 2010
+ * </p>
+ */
+public class ServerIdentityWithoutLeasingVersionTestCase extends InvokerTestDriver
+{
+   public void declareTestClasses()
+   {
+      addTestClasses("org.jboss.test.remoting.versioning.identity.ServerIdentityWithoutLeasingVersionTestClient",
+                     1,
+                     "org.jboss.test.remoting.versioning.identity.ServerIdentityVersionTestServer");
+   }
+   
+   /**
+    * Returns the classpath to be added to the classpath used to start the client tests.
+    * Default return is null, which means no extra classpath will be added.
+    *
+    * @return
+    */
+   protected String getExtendedServerClasspath()
+   {
+      return System.getProperty("server.path");
+   }
+
+   /**
+    * Returns the classpath to be added to the classpath used to start the client tests.
+    * Default return is null, which means no extra classpath will be added.
+    *
+    * @return
+    */
+   protected String getExtendedClientClasspath()
+   {
+      return System.getProperty("client.path");
+   }
+   
+   protected String getClientJVMArguments()
+   {
+      String prop = System.getProperty("client.pre_2_0_compatible");
+      String args = "";
+      if (prop != null && !"".equals(prop))
+      {
+         args = "-Djboss.remoting.pre_2_0_compatible=" + prop;
+      }
+      else
+      {
+         prop = System.getProperty("client.version");
+         if (prop != null && !"".equals(prop))
+            args = "-Djboss.remoting.version=" + prop;
+      }
+      prop = System.getProperty("client.check_connection");
+      if (prop != null && !"".equals(prop))
+      {
+         args += " -Dremoting.metadata=socket.check_connection=" + prop;
+      }
+      System.out.println("client arg: " + args);
+      return args;
+   }
+
+
+   protected String getServerJVMArguments()
+   {
+      String prop = System.getProperty("server.pre_2_0_compatible");
+      String args = "";
+      if (prop != null && !"".equals(prop))
+      {
+         args = "-Djboss.remoting.pre_2_0_compatible=" + prop;
+      }
+      else
+      {
+         prop = System.getProperty("server.version");
+         if (prop != null && !"".equals(prop))
+            args = "-Djboss.remoting.version=" + prop;
+      }
+      prop = System.getProperty("server.check_connection");
+      if (prop != null && !"".equals(prop))
+      {
+         args += " -Dremoting.metadata=socket.check_connection=" + prop;
+      }
+      prop = System.getProperty("clientImplementsServerIdentity");
+      if (prop != null && !"".equals(prop))
+      {
+         args += " -DclientImplementsServerIdentity=" + prop;
+      }
+      prop = System.getProperty("serverImplementsServerIdentity");
+      if (prop != null && !"".equals(prop))
+      {
+         args += " -DserverImplementsServerIdentity=" + prop;
+      }
+      System.out.println("server arg: " + args);
+      return args;
+   }
+   
+
+   protected Level getTestHarnessLogLevel()
+   {
+      return Level.INFO;
+   }
+
+   protected Level getTestLogLevel()
+   {
+      return Level.INFO;
+   }
+
+   /**
+    * How long to wait for test results to be returned from the client(s).  If goes longer than the
+    * specified limit, will throw an exception and kill the running test cases.  Default value is
+    * RESULTS_TIMEOUT.
+    *
+    * @return
+    */
+   protected long getResultsTimeout()
+   {
+      return 60000;
+   }
+
+   /**
+    * How long for the server test case to wait for tear down message.  If exceeds timeout,
+    * will throw exception.  The default value is TEARDOWN_TIMEOUT.
+    *
+    * @return
+    */
+   protected long getTearDownTimeout()
+   {
+      return 60000;
+   }
+
+   /**
+    * How long to allow each of the test cases to run their tests.  If exceeds this timeout
+    * will throw exception and kill tests.  The default value is RUN_TEST_TIMEOUT.
+    *
+    * @return
+    */
+   protected long getRunTestTimeout()
+   {
+      return 60000;
+   }
+
+
+}

Deleted: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestClient.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestClient.java	2010-12-15 23:26:35 UTC (rev 6174)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestClient.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -1,198 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2010, 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.versioning.identity;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-
-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.ConnectionListener;
-import org.jboss.remoting.ConnectionValidator;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.Remoting;
-
-
-/**
- * Versioning Unit tests for JBREM-1144.
- * 
- * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Rev$
- * <p>
- * Copyright Nov 17, 2010
- * </p>
- */
-public class ServerIdentityWithoutLeasingVersionTestClient extends TestCase
-{
-   private static Logger log = Logger.getLogger(ServerIdentityWithoutLeasingVersionTestClient.class);
-   private static boolean firstTime = true;
-
-   private String host;
-   private boolean clientImplementsServerIdentity;
-   private boolean serverImplementsServerIdentity;
-   
-   public void setUp() throws Exception
-   {
-      if (firstTime)
-      {
-         firstTime = false;
-         Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
-         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);
-      }
-      
-      clientImplementsServerIdentity = Boolean.getBoolean("clientImplementsServerIdentity");
-      serverImplementsServerIdentity = Boolean.getBoolean("serverImplementsServerIdentity");
-      host = InetAddress.getLocalHost().getHostAddress();
-      log.info(this + " clientImplementsServerIdentity: " + clientImplementsServerIdentity);
-      log.info(this + " serverImplementsServerIdentity: " + serverImplementsServerIdentity);  
-      log.info(this + " host: " + host);
-   }
-
-   
-   public void tearDown()
-   {
-   }
-   
-   
-   public void testServerIdentityWithoutLeasing() throws Throwable
-   {
-      log.info("entering " + getName());
-      
-      InvokerLocator clientLocator = new InvokerLocator(createLocatorURI());
-      log.info(this + "clientLocator: " + clientLocator);
-      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 connection.
-      assertEquals("abc", client.invoke("abc"));
-      log.info("connection is good");
-      
-      // Run appropriate test.
-      if (clientImplementsServerIdentity && serverImplementsServerIdentity)
-      {
-         assertTrue(doServerIdentitySupportedTest(client));
-      }
-      else
-      {
-         assertTrue(doServerIdentityUnsupportedTest(client));
-      }
-
-      client.disconnect();
-      log.info(getName() + " PASSES");
-   }
-   
-   
-   protected String getTransport()
-   {
-      return "socket";
-   }
-   
-   
-   protected void addExtraClientConfig(Map config) {}
-   
-
-   protected String createLocatorURI() throws UnknownHostException
-   {
-      String locatorURI = getTransport() + "://" + host + ":" + ServerIdentityVersionTestServer.PORT + "/?" + Remoting.USE_SERVER_CONNECTION_IDENTITY + "=true";
-      String metadata = System.getProperty("remoting.metadata");
-      if (metadata != null)
-      {
-         locatorURI += "&" + metadata;
-      }
-      return locatorURI;
-   }
-   
-   
-   protected boolean doServerIdentitySupportedTest(Client client) throws Exception
-   {
-      log.info("running server identity supported test");
-      
-      // Install connection listener.
-      TestConnectionListener listener = new TestConnectionListener();
-      HashMap metadata = new HashMap();
-      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
-      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "10000");
-      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "10000");
-      client.addConnectionListener(listener, metadata);
-      log.info(this + " added connection listener: " + listener);
-      
-      // Allow time to get serverId of first server.
-      Thread.sleep(15000);
-      
-      // Verify listener is notified if server bounces (assuming the server identity
-      // facility is available.
-      Thread.sleep(10000);
-      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
-      return listener.connectionFailed;
-   }
-   
-   
-   protected boolean doServerIdentityUnsupportedTest(Client client) throws Exception
-   {
-      log.info("running server identity unsupported test");
-      
-      // Install connection listener.
-      TestConnectionListener listener = new TestConnectionListener();
-      HashMap metadata = new HashMap();
-      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
-      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "1000");
-      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "1000");
-      client.addConnectionListener(listener, metadata);
-      log.info(this + " added connection listener: " + listener);
-      
-      // Allow ConnectionValidator to run for a while.
-      Thread.sleep(10000);
-      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
-      return !listener.connectionFailed;
-   }
-   
-   
-   static class TestConnectionListener implements ConnectionListener
-   {
-      public boolean connectionFailed;
-      public Throwable throwable;
-      
-      public void handleConnectionException(Throwable throwable, Client client)
-      {
-         connectionFailed = true;
-         this.throwable = throwable;
-         log.info(this + " received connection notification: connectionFailed: " + connectionFailed);
-      }
-      
-   }
-}
\ No newline at end of file

Copied: remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestClient.java (from rev 6174, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestClient.java)
===================================================================
--- remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestClient.java	                        (rev 0)
+++ remoting2/branches/2.2.3-SP3_JBREM-1144_JBREM-1261_JBREM-1262_JBREM-1263_JBREM-1268_JBREM-1269_JBREM-1275/src/tests/org/jboss/test/remoting/versioning/identity/ServerIdentityWithoutLeasingVersionTestClient.java	2011-03-02 03:35:31 UTC (rev 6276)
@@ -0,0 +1,198 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, 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.versioning.identity;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+
+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.ConnectionListener;
+import org.jboss.remoting.ConnectionValidator;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Remoting;
+
+
+/**
+ * Versioning Unit tests for JBREM-1144.
+ * 
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Nov 17, 2010
+ * </p>
+ */
+public class ServerIdentityWithoutLeasingVersionTestClient extends TestCase
+{
+   private static Logger log = Logger.getLogger(ServerIdentityWithoutLeasingVersionTestClient.class);
+   private static boolean firstTime = true;
+
+   private String host;
+   private boolean clientImplementsServerIdentity;
+   private boolean serverImplementsServerIdentity;
+   
+   public void setUp() throws Exception
+   {
+      if (firstTime)
+      {
+         firstTime = false;
+         Logger.getLogger("org.jboss.remoting").setLevel(XLevel.TRACE);
+         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);
+      }
+      
+      clientImplementsServerIdentity = Boolean.getBoolean("clientImplementsServerIdentity");
+      serverImplementsServerIdentity = Boolean.getBoolean("serverImplementsServerIdentity");
+      host = InetAddress.getLocalHost().getHostAddress();
+      log.info(this + " clientImplementsServerIdentity: " + clientImplementsServerIdentity);
+      log.info(this + " serverImplementsServerIdentity: " + serverImplementsServerIdentity);  
+      log.info(this + " host: " + host);
+   }
+
+   
+   public void tearDown()
+   {
+   }
+   
+   
+   public void testServerIdentityWithoutLeasing() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      InvokerLocator clientLocator = new InvokerLocator(createLocatorURI());
+      log.info(this + "clientLocator: " + clientLocator);
+      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 connection.
+      assertEquals("abc", client.invoke("abc"));
+      log.info("connection is good");
+      
+      // Run appropriate test.
+      if (clientImplementsServerIdentity && serverImplementsServerIdentity)
+      {
+         assertTrue(doServerIdentitySupportedTest(client));
+      }
+      else
+      {
+         assertTrue(doServerIdentityUnsupportedTest(client));
+      }
+
+      client.disconnect();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   protected String getTransport()
+   {
+      return "socket";
+   }
+   
+   
+   protected void addExtraClientConfig(Map config) {}
+   
+
+   protected String createLocatorURI() throws UnknownHostException
+   {
+      String locatorURI = getTransport() + "://" + host + ":" + ServerIdentityVersionTestServer.PORT + "/?" + Remoting.USE_SERVER_CONNECTION_IDENTITY + "=true";
+      String metadata = System.getProperty("remoting.metadata");
+      if (metadata != null)
+      {
+         locatorURI += "&" + metadata;
+      }
+      return locatorURI;
+   }
+   
+   
+   protected boolean doServerIdentitySupportedTest(Client client) throws Exception
+   {
+      log.info("running server identity supported test");
+      
+      // Install connection listener.
+      TestConnectionListener listener = new TestConnectionListener();
+      HashMap metadata = new HashMap();
+      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "10000");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "10000");
+      client.addConnectionListener(listener, metadata);
+      log.info(this + " added connection listener: " + listener);
+      
+      // Allow time to get serverId of first server.
+      Thread.sleep(15000);
+      
+      // Verify listener is notified if server bounces (assuming the server identity
+      // facility is available.
+      Thread.sleep(10000);
+      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
+      return listener.connectionFailed;
+   }
+   
+   
+   protected boolean doServerIdentityUnsupportedTest(Client client) throws Exception
+   {
+      log.info("running server identity unsupported test");
+      
+      // Install connection listener.
+      TestConnectionListener listener = new TestConnectionListener();
+      HashMap metadata = new HashMap();
+      metadata.put(Remoting.USE_SERVER_CONNECTION_IDENTITY, "true");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "1000");
+      metadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "1000");
+      client.addConnectionListener(listener, metadata);
+      log.info(this + " added connection listener: " + listener);
+      
+      // Allow ConnectionValidator to run for a while.
+      Thread.sleep(10000);
+      log.info(this + " listener.connectionFailed: " + listener.connectionFailed);
+      return !listener.connectionFailed;
+   }
+   
+   
+   static class TestConnectionListener implements ConnectionListener
+   {
+      public boolean connectionFailed;
+      public Throwable throwable;
+      
+      public void handleConnectionException(Throwable throwable, Client client)
+      {
+         connectionFailed = true;
+         this.throwable = throwable;
+         log.info(this + " received connection notification: connectionFailed: " + connectionFailed);
+      }
+      
+   }
+}
\ No newline at end of file



More information about the jboss-remoting-commits mailing list