| Constructor and Description |
|---|
WebSocketFactory() |
| Modifier and Type | Method and Description |
|---|---|
WebSocket |
createSocket(String uri)
Create a web socket.
|
WebSocket |
createSocket(String uri,
int timeout)
Create a web socket.
|
WebSocket |
createSocket(URI uri)
Create a web socket.
|
WebSocket |
createSocket(URI uri,
int timeout)
Create a web socket.
|
WebSocket |
createSocket(URL url)
Create a web socket.
|
WebSocket |
createSocket(URL url,
int timeout)
Create a web socket.
|
int |
getConnectionTimeout()
Get the timeout value in milliseconds for socket connection.
|
ProxySettings |
getProxySettings()
Get the proxy settings.
|
SocketFactory |
getSocketFactory()
Get the socket factory that has been set by
setSocketFactory(SocketFactory). |
SSLContext |
getSSLContext()
Get the SSL context that has been set by
setSSLContext(SSLContext). |
SSLSocketFactory |
getSSLSocketFactory()
Get the SSL socket factory that has been set by
setSSLSocketFactory(SSLSocketFactory). |
WebSocketFactory |
setConnectionTimeout(int timeout)
Set the timeout value in milliseconds for socket connection.
|
WebSocketFactory |
setSocketFactory(SocketFactory factory)
Set a socket factory.
|
WebSocketFactory |
setSSLContext(SSLContext context)
Set an SSL context to get a socket factory.
|
WebSocketFactory |
setSSLSocketFactory(SSLSocketFactory factory)
Set an SSL socket factory.
|
public SocketFactory getSocketFactory()
setSocketFactory(SocketFactory).public WebSocketFactory setSocketFactory(SocketFactory factory)
createSocket(URI) for details.factory - A socket factory.this instance.public SSLSocketFactory getSSLSocketFactory()
setSSLSocketFactory(SSLSocketFactory).public WebSocketFactory setSSLSocketFactory(SSLSocketFactory factory)
createSocket(URI) for details.factory - An SSL socket factory.this instance.public SSLContext getSSLContext()
setSSLContext(SSLContext).public WebSocketFactory setSSLContext(SSLContext context)
createSocket(URI) for details.context - An SSL context.this instance.public ProxySettings getProxySettings()
ProxySettingspublic int getConnectionTimeout()
When a createSocket method which does not have timeout argument is called, the value returned by this method
is used as a timeout value for socket connection.
public WebSocketFactory setConnectionTimeout(int timeout)
timeout - The connection timeout value in milliseconds.this object.IllegalArgumentException - The given timeout value is negative.public WebSocket createSocket(String uri) throws IOException
This method is an alias of createSocket(uri, getConnectionTimeout()).
uri - The URI of the web socket endpoint on the server side.IllegalArgumentException - The given URI is null or violates RFC 2396.IOException - Failed to create a socket. Or, HTTP proxy handshake or SSL
handshake failed.public WebSocket createSocket(String uri, int timeout) throws IOException
This method is an alias of createSocket(URI.create(uri), timeout).
uri - The URI of the web socket endpoint on the server side.timeout - The timeout value in milliseconds for socket connection.
A timeout of zero is interpreted as an infinite timeout.IllegalArgumentException - The given URI is null or violates RFC 2396, or
the given timeout value is negative.IOException - Failed to create a socket. Or, HTTP proxy handshake or SSL
handshake failed.public WebSocket createSocket(URL url) throws IOException
This method is an alias of createSocket(url, getConnectionTimeout()).
url - The URL of the web socket endpoint on the server side.IllegalArgumentException - The given URL is null or failed to be converted into a URI.IOException - Failed to create a socket. Or, HTTP proxy handshake or SSL
handshake failed.public WebSocket createSocket(URL url, int timeout) throws IOException
This method is an alias of createSocket(url.toURI(), timeout).
url - The URL of the web socket endpoint on the server side.timeout - The timeout value in milliseconds for socket connection.IllegalArgumentException - The given URL is null or failed to be converted into a URI,
or the given timeout value is negative.IOException - Failed to create a socket. Or, HTTP proxy handshake or SSL
handshake failed.public WebSocket createSocket(URI uri) throws IOException
createSocket(uri, getConnectionTimeout()).
A socket factory (= a SocketFactory instance) to create a raw
socket (= a Socket instance) is determined as described below.
wss or https,
SSLContext instance has been set by setSSLContext(SSLContext), the value returned from SSLContext.getSocketFactory() method of the instance is used.
SSLSocketFactory instance has been
set by setSSLSocketFactory(SSLSocketFactory), the
instance is used.
SSLSocketFactory.getDefault()
is used.
ws or http),
SocketFactory instance has been set by setSocketFactory(SocketFactory), the instance is used.
SocketFactory.getDefault()
is used.
uri - The URI of the web socket endpoint on the server side.
The scheme part of the URI must be one of ws,
wss, http and https
(case-insensitive).IllegalArgumentException - The given URI is null or violates RFC 2396.IOException - Failed to create a socket. Or, HTTP proxy handshake or SSL
handshake failed.public WebSocket createSocket(URI uri, int timeout) throws IOException
A socket factory (= a SocketFactory instance) to create a raw
socket (= a Socket instance) is determined as described below.
wss or https,
SSLContext instance has been set by setSSLContext(SSLContext), the value returned from SSLContext.getSocketFactory() method of the instance is used.
SSLSocketFactory instance has been
set by setSSLSocketFactory(SSLSocketFactory), the
instance is used.
SSLSocketFactory.getDefault()
is used.
ws or http),
SocketFactory instance has been set by setSocketFactory(SocketFactory), the instance is used.
SocketFactory.getDefault()
is used.
uri - The URI of the web socket endpoint on the server side.
The scheme part of the URI must be one of ws,
wss, http and https
(case-insensitive).timeout - The timeout value in milliseconds for socket connection.IllegalArgumentException - The given URI is null or violates RFC 2396, or
the given timeout value is negative.IOException - Failed to create a socket. Or, HTTP proxy handshake or SSL
handshake failed.Copyright © 2015. All rights reserved.