Skip to content

Instantly share code, notes, and snippets.

@restfulhead
Created January 7, 2017 22:07
Show Gist options
  • Save restfulhead/684d5b9aa8016c56a64246c4f3fca8a4 to your computer and use it in GitHub Desktop.
Save restfulhead/684d5b9aa8016c56a64246c4f3fca8a4 to your computer and use it in GitHub Desktop.
Test Java TLSv1.2 connection
import java.net.*;
import java.io.*;
class Main {
public static void main(String[] args) throws Exception {
System.setProperty("https.protocols", "TLSv1.2");
System.setProperty("javax.net.debug", "all");
final URL url = new URL("https://your-server-to-test");
try(final InputStream in = url.openStream()){
//…
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment