Package org.apache.thrift.transport
Class TSSLTransportFactory
java.lang.Object
org.apache.thrift.transport.TSSLTransportFactory
A Factory for providing and setting up Client and Server SSL wrapped TSocket and TServerSocket
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A Class to hold all the SSL parameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TSocket
getClientSocket
(String host, int port) Get a default SSL wrapped TSocket connected to the specified host and port.static TSocket
getClientSocket
(String host, int port, int timeout) Get a default SSL wrapped TSocket connected to the specified host and port.static TSocket
getClientSocket
(String host, int port, int timeout, TSSLTransportFactory.TSSLTransportParameters params) Get a custom configured SSL wrapped TSocket.static TServerSocket
getServerSocket
(int port) Get a SSL wrapped TServerSocket bound to the specified port.static TServerSocket
getServerSocket
(int port, int clientTimeout) Get a default SSL wrapped TServerSocket bound to the specified portstatic TServerSocket
getServerSocket
(int port, int clientTimeout, boolean clientAuth, InetAddress ifAddress) Get a default SSL wrapped TServerSocket bound to the specified port and interfacestatic TServerSocket
getServerSocket
(int port, int clientTimeout, InetAddress ifAddress, TSSLTransportFactory.TSSLTransportParameters params) Get a configured SSL wrapped TServerSocket bound to the specified port and interface.
-
Constructor Details
-
TSSLTransportFactory
public TSSLTransportFactory()
-
-
Method Details
-
getServerSocket
Get a SSL wrapped TServerSocket bound to the specified port. In this configuration the default settings are used. Default settings are retrieved from System properties that are set.Example system properties: -Djavax.net.ssl.trustStore=<truststore location> -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStore=<keystore location> -Djavax.net.ssl.keyStorePassword=password
- Parameters:
port
- server port- Returns:
- A SSL wrapped TServerSocket
- Throws:
TTransportException
- when failed to create server socket
-
getServerSocket
Get a default SSL wrapped TServerSocket bound to the specified port- Parameters:
port
-clientTimeout
-- Returns:
- A SSL wrapped TServerSocket
- Throws:
TTransportException
-
getServerSocket
public static TServerSocket getServerSocket(int port, int clientTimeout, boolean clientAuth, InetAddress ifAddress) throws TTransportException Get a default SSL wrapped TServerSocket bound to the specified port and interface- Parameters:
port
-clientTimeout
-ifAddress
-- Returns:
- A SSL wrapped TServerSocket
- Throws:
TTransportException
-
getServerSocket
public static TServerSocket getServerSocket(int port, int clientTimeout, InetAddress ifAddress, TSSLTransportFactory.TSSLTransportParameters params) throws TTransportException Get a configured SSL wrapped TServerSocket bound to the specified port and interface. Here the TSSLTransportParameters are used to set the values for the algorithms, keystore, truststore and other settings- Parameters:
port
-clientTimeout
-ifAddress
-params
-- Returns:
- A SSL wrapped TServerSocket
- Throws:
TTransportException
-
getClientSocket
public static TSocket getClientSocket(String host, int port, int timeout) throws TTransportException Get a default SSL wrapped TSocket connected to the specified host and port. All the client methods return a bound connection. So there is no need to call open() on the TTransport.- Parameters:
host
-port
-timeout
-- Returns:
- A SSL wrapped TSocket
- Throws:
TTransportException
-
getClientSocket
Get a default SSL wrapped TSocket connected to the specified host and port.- Parameters:
host
-port
-- Returns:
- A SSL wrapped TSocket
- Throws:
TTransportException
-
getClientSocket
public static TSocket getClientSocket(String host, int port, int timeout, TSSLTransportFactory.TSSLTransportParameters params) throws TTransportException Get a custom configured SSL wrapped TSocket. The SSL settings are obtained from the passed in TSSLTransportParameters.- Parameters:
host
-port
-timeout
-params
-- Returns:
- A SSL wrapped TSocket
- Throws:
TTransportException
-