public abstract class AbstractTLSSocketFactory extends SSLSocketFactory
TLSSocketFactory
.Modifier and Type | Field and Description |
---|---|
protected String[] |
cipherSuites
Enabled cipher suites.
|
static String |
DEFAULT_PROTOCOL
Default SSL protocol, value is "TLS".
|
protected SSLSocketFactory |
factory
SSLSocketFactory used for creating SSL sockets.
|
protected HostnameVerifier |
hostnameVerifier
Hostname verifier for this socket factory.
|
protected String[] |
protocols
Enabled protocol versions.
|
Constructor and Description |
---|
AbstractTLSSocketFactory() |
Modifier and Type | Method and Description |
---|---|
Socket |
createSocket()
This creates an unconnected socket.
|
Socket |
createSocket(InetAddress host,
int port)
This creates a socket and connects it to the specified port number at the
specified address.
|
Socket |
createSocket(InetAddress address,
int port,
InetAddress localAddress,
int localPort)
This creates a socket and connect it to the specified port number at the
specified address.
|
Socket |
createSocket(Socket s,
String host,
int port,
boolean autoClose)
This returns a socket layered over an existing socket connected to the
named host, at the given port.
|
Socket |
createSocket(String host,
int port)
This creates a socket and connects it to the specified port number at the
specified address.
|
Socket |
createSocket(String host,
int port,
InetAddress localHost,
int localPort)
This creates a socket and connect it to the specified port number at the
specified address.
|
String[] |
getDefaultCipherSuites()
This returns the list of cipher suites which are enabled by default.
|
String[] |
getEnabledCipherSuites()
This returns the names of the SSL cipher suites which are currently enabled
for use on sockets created by this factory.
|
String[] |
getEnabledProtocols()
This returns the names of the protocol versions which are currently enabled
for use on sockets created by this factory.
|
SSLSocketFactory |
getFactory()
This returns the underlying
SSLSocketFactory that this class
uses for creating SSL Sockets. |
HostnameVerifier |
getHostnameVerifier()
Returns the hostname verifier to invoke when sockets are created.
|
String[] |
getSupportedCipherSuites()
This returns the names of the cipher suites which could be enabled for use
on an SSL connection.
|
abstract void |
initialize()
Prepares this socket factory for use.
|
protected SSLSocket |
initSSLSocket(SSLSocket s)
Initializes the supplied socket for use.
|
void |
setEnabledCipherSuites(String[] s)
Sets the cipher suites enabled for use on sockets created by this factory.
|
void |
setEnabledProtocols(String[] s)
Sets the protocol versions enabled for use on sockets created by this
factory.
|
void |
setHostnameVerifier(HostnameVerifier verifier)
Sets the hostname verifier to invoke when sockets are created.
|
getDefault
public static final String DEFAULT_PROTOCOL
protected SSLSocketFactory factory
protected HostnameVerifier hostnameVerifier
protected String[] cipherSuites
protected String[] protocols
public abstract void initialize() throws GeneralSecurityException
GeneralSecurityException
- if the factory cannot be initializedpublic SSLSocketFactory getFactory()
SSLSocketFactory
that this class
uses for creating SSL Sockets.SSLSocketFactory
public HostnameVerifier getHostnameVerifier()
public void setHostnameVerifier(HostnameVerifier verifier)
verifier
- for SSL hostnamespublic String[] getEnabledCipherSuites()
String[]
of cipher suitespublic void setEnabledCipherSuites(String[] s)
SSLSocket.setEnabledCipherSuites(String[])
.s
- String[]
of cipher suitespublic String[] getEnabledProtocols()
String[]
of protocolspublic void setEnabledProtocols(String[] s)
SSLSocket.setEnabledProtocols(String[])
.s
- String[]
of cipher suitesprotected SSLSocket initSSLSocket(SSLSocket s) throws IOException
s
- SSLSocket
to initializeSSLSocket
IOException
- if an I/O error occurs when initializing the socketpublic Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException
createSocket
in class SSLSocketFactory
s
- Socket
existing sockethost
- String
server hostnameport
- int
server portautoClose
- boolean
close the underlying socket when
this socket is closedSocket
- connected to the specified host and portIOException
- if an I/O error occurs when creating the socketpublic Socket createSocket() throws IOException
createSocket
in class SocketFactory
Socket
- unconnected socketIOException
- if an I/O error occurs when creating the socketpublic Socket createSocket(InetAddress host, int port) throws IOException
createSocket
in class SocketFactory
host
- InetAddress
server hostnameport
- int
server portSocket
- connected to the specified host and portIOException
- if an I/O error occurs when creating the socketpublic Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException
createSocket
in class SocketFactory
address
- InetAddress
server hostnameport
- int
server portlocalAddress
- InetAddress
client hostnamelocalPort
- int
client portSocket
- connected to the specified host and portIOException
- if an I/O error occurs when creating the socketpublic Socket createSocket(String host, int port) throws IOException
createSocket
in class SocketFactory
host
- String
server hostnameport
- int
server portSocket
- connected to the specified host and portIOException
- if an I/O error occurs when creating the socketpublic Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException
createSocket
in class SocketFactory
host
- String
server hostnameport
- int
server portlocalHost
- InetAddress
client hostnamelocalPort
- int
client portSocket
- connected to the specified host and portIOException
- if an I/O error occurs when creating the socketpublic String[] getDefaultCipherSuites()
getDefaultCipherSuites
in class SSLSocketFactory
String[]
- array of the cipher suitespublic String[] getSupportedCipherSuites()
getSupportedCipherSuites
in class SSLSocketFactory
String[]
- array of the cipher suitesCopyright © 2014. All rights reserved.