SSLPoke

SSL Poke
java -Djavax.net.ssl.keystore=/somekeystorefile SSLPoke login.yahoo.com 443 java -Djavax.net.ssl.keystore=/somekeystorefile -Djavax.net.ssl.keystorepassword=somepassword SSLPoke login.yahoo.com 443
 * https://secure.marumoto.us/motowiki5/tiki-print.php?page_ref_id=187&page=Test%20a%20Java%20SSL%20connection
 * https://secure.marumoto.us/motowiki5/tiki-index.php?page=Test+a+Java+SSL+connection
 * http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services

import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import java.io.*;

/** * Establish a SSL connection to a host and port, writes a byte and * prints the response. See * http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services */ public class SSLPoke {

public static void main(String[] args) { if (args.length != 2) { System.out.println("Usage: "+SSLPoke.class.getName+" "); System.exit(1); }     try { SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault; SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(args[0], Integer.parseInt(args[1])); InputStream in = sslsocket.getInputStream; OutputStream out = sslsocket.getOutputStream; // Write a test byte to get a reaction :)        out.write(1);         while (in.available > 0) {            System.out.print(in.read);         }         System.out.println("Successfully connected");      } catch (Exception exception) {         exception.printStackTrace;      }   } }