Created
May 10, 2018 16:00
-
-
Save cdman/5a7788af5157859e6888ea4c516f7614 to your computer and use it in GitHub Desktop.
Java SSL test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.InputStream; | |
import java.net.URL; | |
import java.util.Map.Entry; | |
public final class Main { | |
public static void main(String... args) throws Exception { | |
printSSLProperties(); | |
URL url = new URL("https://dv3.datavalidation.com/"); | |
System.out.println("Downloaded " + readAll(url.openStream()) + " bytes"); | |
} | |
private static final long readAll(InputStream ins) throws Exception { | |
long result = 0; | |
byte[] buf = new byte[1024]; | |
while (true) { | |
int r = ins.read(buf); | |
if (r == -1) { | |
break; | |
} | |
result += r; | |
} | |
return result; | |
} | |
private static void printSSLProperties() { | |
for (Entry<Object, Object> entry : System.getProperties().entrySet()) { | |
String key = entry.getKey().toString(); | |
if (!key.contains("ssl")) { | |
continue; | |
} | |
System.out.println(key + "=" + entry.getValue()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment