Package ej.websocket
Class WebSocketSecure
- java.lang.Object
-
- ej.websocket.WebSocket
-
- ej.websocket.WebSocketSecure
-
- All Implemented Interfaces:
AutoCloseable
public class WebSocketSecure extends WebSocket
Representation for the physical websocket connection that support SSL Context.WebSocket.
-
-
Constructor Summary
Constructors Constructor Description WebSocketSecure(WebSocketURI uri, Endpoint endpoint)Create a newWebSocketinstance.WebSocketSecure(WebSocketURI uri, Endpoint endpoint, SSLContext context)Create a newWebSocketinstance with SSL support.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidsetupSocket()Open the socket and sets it.-
Methods inherited from class ej.websocket.WebSocket
addHeader, close, close, connect, getCurrentState, getEndpoint, getURI, ping, ping, pong, pong, sendBinary, sendText, setSocket
-
-
-
-
Constructor Detail
-
WebSocketSecure
public WebSocketSecure(WebSocketURI uri, Endpoint endpoint) throws IllegalArgumentException, NoSuchAlgorithmException
Create a newWebSocketinstance. It doesn't connect to the remote server; user has to callWebSocket.connect()to do so.- Parameters:
uri- URI to connect toendpoint- the endpoint that will handle events- Throws:
IllegalArgumentException- if 'endpoint' or 'uri' is nullNoSuchAlgorithmException- if the default SSLContext is not supported.- See Also:
SSLContext.getDefault()
-
WebSocketSecure
public WebSocketSecure(WebSocketURI uri, Endpoint endpoint, SSLContext context) throws IllegalArgumentException, NoSuchAlgorithmException
Create a newWebSocketinstance with SSL support. It doesn't connect to the remote server; user has to callWebSocket.connect()to do so.- Parameters:
uri- URI to connect toendpoint- the endpoint that will handle eventscontext- the SSL context to use, ifnulluses the default SSLContext.- Throws:
IllegalArgumentException- if 'endpoint' or 'uri' is null, or if 'uri' is not securedNoSuchAlgorithmException- if context is null and does not- See Also:
SSLContext.getDefault()
-
-
Method Detail
-
setupSocket
protected void setupSocket() throws IOExceptionDescription copied from class:WebSocketOpen the socket and sets it.- Overrides:
setupSocketin classWebSocket- Throws:
IOException- if anIOExceptionoccurs.- See Also:
WebSocket.setSocket(Socket)
-
-