Package com.attivio.transport.http.ssl
Class EasySSLProtocolSocketFactory
- java.lang.Object
-
- com.attivio.transport.http.ssl.EasySSLProtocolSocketFactory
-
- All Implemented Interfaces:
org.apache.http.conn.socket.ConnectionSocketFactory
public class EasySSLProtocolSocketFactory extends java.lang.Object implements org.apache.http.conn.socket.ConnectionSocketFactory
EasySSLProtocolSocketFactory can be used to creats SSLSocket
s that accept self-signed certificates.This socket factory SHOULD NOT be used for productive systems due to security reasons, unless it is a concious decision and you are perfectly aware of security implications of accepting self-signed certificates
Example of using custom protocol socket factory for a specific host:
Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); HttpClient client = new HttpClient(); client.getHostConfiguration().setHost("localhost", 443, easyhttps); // use relative url only GetMethod httpget = new GetMethod("/"); client.executeMethod(httpget);
Example of using custom protocol socket factory per default instead of the standard one:
Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); Protocol.registerProtocol("https", easyhttps); HttpClient client = new HttpClient(); GetMethod httpget = new GetMethod("https://localhost/"); client.executeMethod(httpget);
- Author:
- Oleg Kalnichevski
DISCLAIMER: HttpClient developers DO NOT actively support this component. The component is provided as a reference material, which may be inappropriate for use without additional customization.
-
-
Constructor Summary
Constructors Constructor Description EasySSLProtocolSocketFactory()
Constructor for EasySSLProtocolSocketFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.Socket
connectSocket(int connectTimeout, java.net.Socket sock, org.apache.http.HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, org.apache.http.protocol.HttpContext context)
java.net.Socket
createSocket(org.apache.http.protocol.HttpContext context)
boolean
equals(java.lang.Object obj)
int
hashCode()
-
-
-
Method Detail
-
createSocket
public java.net.Socket createSocket(org.apache.http.protocol.HttpContext context) throws java.io.IOException
- Specified by:
createSocket
in interfaceorg.apache.http.conn.socket.ConnectionSocketFactory
- Throws:
java.io.IOException
-
connectSocket
public java.net.Socket connectSocket(int connectTimeout, java.net.Socket sock, org.apache.http.HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, org.apache.http.protocol.HttpContext context) throws java.io.IOException
- Specified by:
connectSocket
in interfaceorg.apache.http.conn.socket.ConnectionSocketFactory
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-