You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2016/06/23 20:05:05 UTC

svn commit: r1750000 - /httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java

Author: ggregory
Date: Thu Jun 23 20:05:05 2016
New Revision: 1750000

URL: http://svn.apache.org/viewvc?rev=1750000&view=rev
Log:
org.apache.http.ssl.TestSSLContextBuilder.testSSLHanskshakeProtocolMismatch2() was failing on Windows with Java 6 but was OK with Java 7 and 8.

Modified:
    httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java?rev=1750000&r1=1749999&r2=1750000&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java (original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java Thu Jun 23 20:05:05 2016
@@ -59,6 +59,8 @@ import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 
+import org.apache.commons.lang3.JavaVersion;
+import org.apache.commons.lang3.SystemUtils;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
@@ -602,9 +604,9 @@ public class TestSSLContextBuilder {
             Assert.assertTrue(supportedClientProtocols.contains("TLSv1"));
             clientSocket.setEnabledProtocols(new String[] { "TLSv1" });
             clientSocket.connect(new InetSocketAddress("localhost", localPort), 5000);
-            final boolean isWindows = System.getProperty("os.name").contains("Windows");
-            final Class<? extends IOException> expectedExceptionClass = isWindows ? SocketException.class
-                    : SSLHandshakeException.class;
+            final Class<? extends IOException> expectedExceptionClass = SystemUtils.IS_OS_WINDOWS
+                    && SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_7) ? SocketException.class
+                            : SSLHandshakeException.class;
             try {
                 clientSocket.startHandshake();
                 Assert.fail();