Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@msach22
Created July 12, 2018 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msach22/6db08f728137ff19c9809ecebf479792 to your computer and use it in GitHub Desktop.
Save msach22/6db08f728137ff19c9809ecebf479792 to your computer and use it in GitHub Desktop.
Run the following code to check your environment
import java.net.URL;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.SocketException;
import java.io.IOException;
class TestTls {
public static void main(String[] args){
URL url = null;
try {
url = new URL("https://preview.opentok.com/tls-check.json");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
System.out.println("Connection successfully established with your current TLS configuration, no further action required.");
} catch(MalformedURLException urlException) {
System.out.println("No legal protocol found in string or the URL could not be parsed.");
} catch(SocketException socketException){
System.out.println("Failed to connect to OpenTok, please check your system and upgrade your environment as needed.");
} catch (IOException e) {
System.out.println("Unknown error talking to OpenTok, please try again later.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment