1 31 32 package org.apache.commons.httpclient.protocol; 33 34 import java.io.IOException ; 35 import java.net.InetAddress ; 36 import java.net.Socket ; 37 import java.net.UnknownHostException ; 38 39 import javax.net.ssl.SSLSocketFactory; 40 41 49 public class SSLProtocolSocketFactory implements SecureProtocolSocketFactory { 50 51 54 private static final SSLProtocolSocketFactory factory = new SSLProtocolSocketFactory(); 55 56 60 static SSLProtocolSocketFactory getSocketFactory() { 61 return factory; 62 } 63 64 67 public SSLProtocolSocketFactory() { 68 super(); 69 } 70 71 74 public Socket createSocket( 75 String host, 76 int port, 77 InetAddress clientHost, 78 int clientPort) 79 throws IOException , UnknownHostException { 80 return SSLSocketFactory.getDefault().createSocket( 81 host, 82 port, 83 clientHost, 84 clientPort 85 ); 86 } 87 88 91 public Socket createSocket(String host, int port) 92 throws IOException , UnknownHostException { 93 return SSLSocketFactory.getDefault().createSocket( 94 host, 95 port 96 ); 97 } 98 99 102 public Socket createSocket( 103 Socket socket, 104 String host, 105 int port, 106 boolean autoClose) 107 throws IOException , UnknownHostException { 108 return ((SSLSocketFactory) SSLSocketFactory.getDefault()).createSocket( 109 socket, 110 host, 111 port, 112 autoClose 113 ); 114 } 115 116 119 public boolean equals(Object obj) { 120 return ((obj != null) && obj.getClass().equals(SSLProtocolSocketFactory.class)); 121 } 122 123 126 public int hashCode() { 127 return SSLProtocolSocketFactory.class.hashCode(); 128 } 129 130 } 131 | Popular Tags |