Skip to content

Instantly share code, notes, and snippets.

@cander

cander/httpstest.java

Last active May 23, 2018
Embed
What would you like to do?
A simple test program to fetch HTTPS URLs that have been problematic with older versions of Java
import java.net.URL;
import java.io.InputStream;
public class httpstest {
public static void fetchUrl(String urlStr, String msg)
{
try {
System.out.println(msg);
System.out.println("Opening " + urlStr);
URL url=new URL(urlStr);
InputStream is=url.openStream();
System.out.println("PASS");
} catch (Throwable e) {
System.out.println("FAIL: " + e.getMessage());
// e.printStackTrace();
}
System.out.println(".");
}
public static void main(String args[])
{
java.lang.System.setProperty("https.protocols", "TLSv1.2,TLSv1.1,TLSv1");
fetchUrl("https://www.buzzfeed.com/sallykaplan/amazon-movers-and-shakers-june21?utm_term=4ldqpia",
"www.buzzfeed.com - not sure why");
fetchUrl("https://www.clientsuccess.com/blog/three-principles-as-a-new-customer-success-manager/",
"www.clientsuccess.com - uses bouncy castle for DH");
fetchUrl("https://www.lexisnexis.com/infopro/rss.aspx?Redirected=true",
"www.lexisnexis.com - uses new cacerts file");
fetchUrl("https://3pardude.com/2015/11/17/3par-latest-feature-announcements/3par-hpe/",
"3pardude.com - WordPress, SSL, TLS/SNI");
fetchUrl("https://www.mx.com/moneysummit/mobile-deposit-key-to-customer-satisfaction-wells-fargo-enters-damage-control-mode-essential-fintech-reading-sept-10-16",
"mx.com - HubSpot, SSL, TLS/SNI");
fetchUrl("https://moz.com/blog/optimized-my-site-but-still-not-ranking-next-level",
"moz.com");
fetchUrl("https://www.nursechoice.com/job-details/?jid=658135",
"nursechoice.com - new GoDaddy cert");
fetchUrl("https://tracking.feedpress.it/link/16145/5806742",
"feedpress redirects to techbeacon.com - odd cert(s)");
fetchUrl("https://www.skuid.com/blog/skuid-cmo-featured-in-cmswire/",
"failed ssl handshake - can't agree on ciphers");
fetchUrl("https://www.aecom.com/without-limits/article/six-alternative-water-sources-texas/",
"AECOM - newer Entrust root cert");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment