org.eclipse.jetty.websocket
Class TestClient

java.lang.Object
  extended by org.eclipse.jetty.websocket.TestClient
All Implemented Interfaces:
WebSocket, WebSocket.OnFrame

public class TestClient
extends Object
implements WebSocket.OnFrame

Version:
$Revision$ $Date$ This is not a general purpose websocket client. It's only for testing the websocket server and is hardwired to a specific draft version of the protocol.

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.jetty.websocket.WebSocket
WebSocket.Connection, WebSocket.FrameConnection, WebSocket.OnBinaryMessage, WebSocket.OnControl, WebSocket.OnFrame, WebSocket.OnTextMessage
 
Constructor Summary
TestClient(String host, int port, String protocol, int timeoutMS)
           
 
Method Summary
 void disconnect()
           
static void main(String[] args)
           
 void onClose(int closeCode, String message)
          Called when an established websocket connection closes
 boolean onFrame(byte flags, byte opcode, byte[] data, int offset, int length)
          Called when any websocket frame is received.
 void onHandshake(WebSocket.FrameConnection connection)
           
 void onOpen(WebSocket.Connection connection)
          Called when a new websocket connection is accepted.
 void ping(byte opcode, byte[] data, int fragment)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestClient

public TestClient(String host,
                  int port,
                  String protocol,
                  int timeoutMS)
           throws Exception
Throws:
Exception
Method Detail

onOpen

public void onOpen(WebSocket.Connection connection)
Description copied from interface: WebSocket
Called when a new websocket connection is accepted.

Specified by:
onOpen in interface WebSocket
Parameters:
connection - The Connection object to use to send messages.

onClose

public void onClose(int closeCode,
                    String message)
Description copied from interface: WebSocket
Called when an established websocket connection closes

Specified by:
onClose in interface WebSocket

onFrame

public boolean onFrame(byte flags,
                       byte opcode,
                       byte[] data,
                       int offset,
                       int length)
Description copied from interface: WebSocket.OnFrame
Called when any websocket frame is received.

Specified by:
onFrame in interface WebSocket.OnFrame
Returns:
true if this call has completely handled the frame and no further processing is needed (including aggregation and/or message delivery)

onHandshake

public void onHandshake(WebSocket.FrameConnection connection)
Specified by:
onHandshake in interface WebSocket.OnFrame

ping

public void ping(byte opcode,
                 byte[] data,
                 int fragment)
          throws Exception
Throws:
Exception

disconnect

public void disconnect()
                throws Exception
Throws:
Exception

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.