|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jscape.inet.ipclient.IpClient
com.jscape.inet.ipclientssl.IpClientSsl
public class IpClientSsl
Implements basic functionality of a secure TLS/SSL TCP/IP client connection.
Example usage:
try { // create new IpClientSsl instance with hostname, port and timeout arguments IpClientSsl client = new IpClientSsl("10.0.0.1",993,5000); // establish connection with server client.connect(); // obtain OutputStream for sending data to server OutputStream out = client.getOutputStream(); // obtain InputStream for reading data from server InputStream in = client.getInputStream(); // disconnect from server client.disconnect(); } catch(IpClientException ipe) { ipe.printStackTrace(); }
Constructor Summary | |
---|---|
IpClientSsl(java.lang.String hostname,
int port)
Creates a new IpClientSsl instance. |
|
IpClientSsl(java.lang.String hostname,
int port,
int timeout)
Creates a new IpClientSsl instance. |
|
IpClientSsl(java.lang.String hostname,
int port,
int timeout,
javax.net.ssl.SSLContext context)
Creates a new IpClientSsl instance. |
|
IpClientSsl(java.lang.String hostname,
int port,
javax.net.ssl.SSLContext context)
Creates a new IpClientSsl instance. |
Method Summary | |
---|---|
void |
clearProxySettings()
Clears proxy server values. |
void |
connect()
Establishes connection with server. |
void |
disconnect()
Closes connection with server. |
void |
setClientCertificates(java.lang.String filename,
java.lang.String password)
Sets optional client certificate to be used during authentication. |
void |
setClientCertificates(java.lang.String filename,
java.lang.String password,
java.lang.String storetype)
Sets optional client certificate to be used during authentication. |
void |
setProxyAuthentication(java.lang.String proxyUsername,
java.lang.String proxyPassword)
Sets the username and password to use when for authentication with proxy server. |
void |
setProxyHost(java.lang.String proxyHostname,
int proxyPort)
Sets the proxy hostname and port for this connection. |
void |
setProxyType(java.lang.String proxyType)
Sets the proxy type will be used for this connection. |
void |
setServerCertificates(java.lang.String filename,
java.lang.String password)
Sets optional server certificate to be used during authentication. |
void |
setServerCertificates(java.lang.String filename,
java.lang.String password,
java.lang.String storetype)
Sets optional server certificate to be used during authentication. |
Methods inherited from class com.jscape.inet.ipclient.IpClient |
---|
addIpClientListener, getConnectTimeout, getInputStream, getOutputStream, getReadTimeout, getSocket, removeIpClientListener, setConnectTimeout, setInputStream, setOutputStream, setReadTimeout, setSocket |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IpClientSsl(java.lang.String hostname, int port)
hostname
- the server hostname or IP addressport
- the server portpublic IpClientSsl(java.lang.String hostname, int port, javax.net.ssl.SSLContext context)
hostname
- the server hostname or IP addressport
- the server portcontext
- an SSLContextpublic IpClientSsl(java.lang.String hostname, int port, int timeout)
hostname
- the server hostname or IP addressport
- the server porttimeout
- the timeout for establishing a connection specified in ms (milliseconds)public IpClientSsl(java.lang.String hostname, int port, int timeout, javax.net.ssl.SSLContext context)
hostname
- the server hostname or IP addressport
- the server porttimeout
- the timeout for establishing a connection specified in ms (milliseconds)context
- an SSLContextSSLContext
Method Detail |
---|
public void setClientCertificates(java.lang.String filename, java.lang.String password)
keytool
utility provided in the Sun JDK.
Example:
keytool.exe -import -file x509.cer -keystore your_store_name
The example above imports the certificate x509.cer into a keystore named your_store_name
filename
- the keystore file containing the client certificatepassword
- the keystore passwordpublic void setClientCertificates(java.lang.String filename, java.lang.String password, java.lang.String storetype)
keytool
utility provided in the Sun JDK.
Example:
keytool.exe -import -file x509.cer -keystore your_store_name
The example above imports the certificate x509.cer into a keystore named your_store_name
filename
- the keystore file containing the client certificatepassword
- the keystore passwordstoretype
- the keystore type valid values include jks and pkcs12public void setServerCertificates(java.lang.String filename, java.lang.String password)
keytool
utility provided in the Sun JDK.
Example:
keytool.exe -import -file x509.cer -keystore your_store_name
The example above imports the certificate x509.cer into a keystore named your_store_name
filename
- the keystore file containing the server certificatepassword
- the keystore passwordpublic void setServerCertificates(java.lang.String filename, java.lang.String password, java.lang.String storetype)
keytool
utility provided in the Sun JDK.
Example:
keytool.exe -import -file x509.cer -keystore your_store_name
The example above imports the certificate x509.cer into a keystore named your_store_name
filename
- the keystore file containing the server certificatepassword
- the keystore passwordstoretype
- the keystore type valid values include jks and pkcs12public void setProxyAuthentication(java.lang.String proxyUsername, java.lang.String proxyPassword)
#clearProxySettings
method.
setProxyAuthentication
in class IpClient
proxyUsername
- the proxy usernameproxyPassword
- the proxy passwordclearProxySettings()
public void setProxyHost(java.lang.String proxyHostname, int proxyPort)
#clearProxySettings
method.
setProxyHost
in class IpClient
proxyHostname
- the hostname or ip address of the proxy serverproxyPort
- the port of the proxy serverclearProxySettings()
public void setProxyType(java.lang.String proxyType)
setProxyType
in class IpClient
proxyType
- The proxy type. Valid values: HTTP, SOCKS5public void clearProxySettings()
clearProxySettings
in class IpClient
public void connect() throws IpClientException
connect
in class IpClient
IpClientException
- if an I/O or network related error occurspublic void disconnect() throws IpClientException
disconnect
in class IpClient
IpClientException
- if an I/O or network related error occurs
|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |