创建一个SSL客户端套接字
//时 代 J a v a - nowjava.com 提供 import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import javax.net.SocketFactory; import javax.net.ssl.SSLSocketFactory; public class Main { public void m() throws Exception { try { int port = 443; String hostname = "hostname"; SocketFactory socketFactory = SSLSocketFactory.getDefault(); Socket socket = socketFactory.createSocket(hostname, port);//来自 时代Java - nowjava.com // Create streams to securely send and receive data to the server InputStream in = socket.getInputStream(); OutputStream out = socket.getOutputStream();