com.pusher.client.connection.websocket
Class WebSocketClientWrapper

java.lang.Object
  extended by org.java_websocket.WebSocketAdapter
      extended by org.java_websocket.client.WebSocketClient
          extended by com.pusher.client.connection.websocket.WebSocketClientWrapper
All Implemented Interfaces:
Runnable, WebSocketListener

public class WebSocketClientWrapper
extends WebSocketClient

A thin wrapper around the WebSocketClient class from the Java-WebSocket library. The purpose of this class is to enable the WebSocketConnection class to be unit tested by swapping out an instance of this wrapper for a mock version.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.java_websocket.client.WebSocketClient
WebSocketClient.DefaultClientProxyChannel, WebSocketClient.WebSocketClientFactory
 
Field Summary
 
Fields inherited from class org.java_websocket.client.WebSocketClient
uri
 
Constructor Summary
WebSocketClientWrapper(URI uri, WebSocketListener proxy)
           
 
Method Summary
 void onClose(int code, String reason, boolean remote)
           
 void onError(Exception ex)
           
 void onMessage(String message)
           
 void onOpen(ServerHandshake handshakedata)
           
 
Methods inherited from class org.java_websocket.client.WebSocketClient
close, closeBlocking, connect, connectBlocking, createProxyChannel, getConnection, getDraft, getLocalSocketAddress, getReadyState, getRemoteSocketAddress, getURI, getWebSocketFactory, onCloseInitiated, onClosing, onMessage, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketOpen, onWriteDemand, run, send, send, setProxy, setWebSocketFactory
 
Methods inherited from class org.java_websocket.WebSocketAdapter
getFlashPolicy, onWebsocketHandshakeReceivedAsClient, onWebsocketHandshakeReceivedAsServer, onWebsocketHandshakeSentAsClient, onWebsocketMessageFragment, onWebsocketPing, onWebsocketPong
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSocketClientWrapper

public WebSocketClientWrapper(URI uri,
                              WebSocketListener proxy)
                       throws SSLException
Throws:
SSLException
Method Detail

onOpen

public void onOpen(ServerHandshake handshakedata)
Specified by:
onOpen in class WebSocketClient

onMessage

public void onMessage(String message)
Specified by:
onMessage in class WebSocketClient

onClose

public void onClose(int code,
                    String reason,
                    boolean remote)
Specified by:
onClose in class WebSocketClient

onError

public void onError(Exception ex)
Specified by:
onError in class WebSocketClient


Copyright © 2013 Pusher. All Rights Reserved.