[teiid-commits] teiid SVN: r2768 - in branches/7.1.x: runtime/src/test/java/org/teiid/transport and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Dec 13 10:31:34 EST 2010


Author: shawkins
Date: 2010-12-13 10:31:33 -0500 (Mon, 13 Dec 2010)
New Revision: 2768

Modified:
   branches/7.1.x/client/src/main/java/org/teiid/net/HostInfo.java
   branches/7.1.x/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
Log:
TEIID-1391 fix for invalid connection reuse

Modified: branches/7.1.x/client/src/main/java/org/teiid/net/HostInfo.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/HostInfo.java	2010-12-13 15:24:48 UTC (rev 2767)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/HostInfo.java	2010-12-13 15:31:33 UTC (rev 2768)
@@ -113,12 +113,12 @@
         if (portNumber != hostInfo.getPortNumber()) {
         	return false;
         }
+        if (ssl != hostInfo.ssl) {
+        	return false;
+        }
         if (inetAddress != null && hostInfo.inetAddress != null) {
         	return inetAddress.equals(hostInfo.inetAddress);
         }
-        if (ssl != hostInfo.ssl) {
-        	return false;
-        }
         return hostName.equals(hostInfo.getHostName());
     }
 

Modified: branches/7.1.x/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- branches/7.1.x/runtime/src/test/java/org/teiid/transport/TestCommSockets.java	2010-12-13 15:24:48 UTC (rev 2767)
+++ branches/7.1.x/runtime/src/test/java/org/teiid/transport/TestCommSockets.java	2010-12-13 15:31:33 UTC (rev 2768)
@@ -194,6 +194,9 @@
 	}
 
 	@Test public void testSSLConnectWithNonSSLServer() throws Exception {
+		//first make a non-ssl connection to ensure that it's not reused
+		SocketServerConnection conn = helpEstablishConnection(false);
+		conn.close();
 		try {
 			helpEstablishConnection(true);
 			fail("exception expected"); //$NON-NLS-1$
@@ -207,12 +210,19 @@
 		config.setMode(SSLConfiguration.ENABLED);
 		config.setAuthenticationMode(SSLConfiguration.ANONYMOUS);
 		Properties p = new Properties();
+		p.setProperty("org.teiid.sockets.soTimeout", "100");
 		helpEstablishConnection(true, config, p);
 		SocketServerConnection conn = helpEstablishConnection(true, config, p);
 		conn.close();
+		
+		try {
+			helpEstablishConnection(false, config, p);
+		} catch (CommunicationException e) {
+			
+		}
 	}
 	
-	@Test(expected=CommunicationException.class) public void testNonSSLConnectWithSSLServer() throws Exception {
+	@Test(expected=CommunicationException.class) public void testNonAnonSSLConnectWithSSLServer() throws Exception {
 		SSLConfiguration config = new SSLConfiguration();
 		config.setMode(SSLConfiguration.ENABLED);
 		config.setAuthenticationMode(SSLConfiguration.ANONYMOUS);



More information about the teiid-commits mailing list