416743: skip certificate test when behind proxy

Change-Id: Ic0eba79abd5ce51bf7a9865711647949e0153597
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=416743
diff --git a/org.eclipse.mylyn.commons.repositories.http.tests/src/org/eclipse/mylyn/commons/repositories/http/tests/CommonHttpClientTest.java b/org.eclipse.mylyn.commons.repositories.http.tests/src/org/eclipse/mylyn/commons/repositories/http/tests/CommonHttpClientTest.java
index 001c037..af0ff56 100644
--- a/org.eclipse.mylyn.commons.repositories.http.tests/src/org/eclipse/mylyn/commons/repositories/http/tests/CommonHttpClientTest.java
+++ b/org.eclipse.mylyn.commons.repositories.http.tests/src/org/eclipse/mylyn/commons/repositories/http/tests/CommonHttpClientTest.java
@@ -26,7 +26,6 @@
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.conn.scheme.Scheme;
 import org.apache.http.util.EntityUtils;
-import org.eclipse.mylyn.commons.core.net.NetUtil;
 import org.eclipse.mylyn.commons.core.net.SslSupport;
 import org.eclipse.mylyn.commons.core.net.TrustAllTrustManager;
 import org.eclipse.mylyn.commons.core.operations.IOperationMonitor;
@@ -56,7 +55,7 @@
 
 	@Test
 	public void testCertificateAuthenticationCertificate() throws Exception {
-		if (CommonTestUtil.isCertificateAuthBroken()) {
+		if (CommonTestUtil.isCertificateAuthBroken() || CommonTestUtil.isBehindProxy()) {
 			System.err.println("Skipped CommonHttpClientTest.testCertificateAuthenticationCertificate() due to incompatible JVM");
 			return; // skip test 
 		}
@@ -82,8 +81,7 @@
 
 	@Test(expected = SSLException.class)
 	public void testCertificateAuthenticationCertificateReset() throws Exception {
-		if (CommonTestUtil.isCertificateAuthBroken()
-				|| NetUtil.getProxyForUrl("https://mylyn.org/secure/index.txt") != null) {
+		if (CommonTestUtil.isCertificateAuthBroken() || CommonTestUtil.isBehindProxy()) {
 			// bug 369805
 			System.err.println("Skipped CommonHttpClientTest.testCertificateAuthenticationCertificateReset due to incompatible JVM");
 			throw new SSLException(""); // skip test 
diff --git a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java
index d92885b..37a8efe 100644
--- a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java
+++ b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java
@@ -42,6 +42,7 @@
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Plugin;
 import org.eclipse.mylyn.commons.core.CoreUtil;
+import org.eclipse.mylyn.commons.core.net.NetUtil;
 import org.eclipse.mylyn.commons.net.WebUtil;
 import org.eclipse.mylyn.commons.repositories.core.auth.CertificateCredentials;
 import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
@@ -556,4 +557,8 @@
 		return Boolean.parseBoolean(System.getProperty(KEY_IGNORE_LOCAL_SERVICES));
 	}
 
+	public static boolean isBehindProxy() {
+		return NetUtil.getProxyForUrl("https://mylyn.org/secure/index.txt") != null;
+	}
+
 }