org.fusesource.stompjms.channel
Class StompSocket

java.lang.Object
  extended by org.fusesource.stompjms.channel.StompSocket
All Implemented Interfaces:
java.lang.Runnable

public class StompSocket
extends java.lang.Object
implements java.lang.Runnable

Version:
$Revision$

Constructor Summary
StompSocket(javax.net.SocketFactory factory, java.net.URI localLocation, java.net.URI remoteLocation)
          Connect to a Broker
 
Method Summary
 void close()
           
 void connect(java.lang.String userName, java.lang.String password, java.lang.String clientId)
          Configures the socket for use
 int getConnectionTimeout()
           
 int getIoBufferSize()
           
 java.lang.Boolean getKeepAlive()
           
 java.lang.String getRemoteAddress()
           
 int getSocketBufferSize()
           
 int getSoTimeout()
           
 java.lang.Boolean getTcpNoDelay()
           
 void initialize()
           
 boolean isConnected()
           
 boolean isStarted()
           
 boolean isStopped()
           
 boolean isStopping()
           
protected  int parseContentLength(java.lang.String contentLength)
           
protected  java.util.HashMap<java.lang.String,java.lang.String> parseHeaders(java.io.DataInput in)
           
 void run()
          reads packets from a Socket
 void sendFrame(StompFrame frame)
          A one way asynchronous send
 void setConnectionTimeout(int connectionTimeout)
          Sets the timeout used to connect to the socket
 void setExceptionListener(javax.jms.ExceptionListener l)
           
 void setIoBufferSize(int ioBufferSize)
           
 void setKeepAlive(java.lang.Boolean keepAlive)
          Enable/disable TCP KEEP_ALIVE mode
 void setSocketBufferSize(int socketBufferSize)
          Sets the buffer size to use on the socket
 void setSoTimeout(int soTimeout)
          Sets the socket timeout
 void setStompFrameListener(StompFrameListener l)
           
 void setTcpNoDelay(java.lang.Boolean tcpNoDelay)
          Enable/disable the TCP_NODELAY option on the socket
 void start()
          Start receiving messages
 void stop()
          stop and close the socket
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StompSocket

public StompSocket(javax.net.SocketFactory factory,
                   java.net.URI localLocation,
                   java.net.URI remoteLocation)
            throws java.net.UnknownHostException,
                   java.io.IOException
Connect to a Broker

Parameters:
factory -
localLocation -
remoteLocation -
Throws:
java.net.UnknownHostException
java.io.IOException
Method Detail

setExceptionListener

public void setExceptionListener(javax.jms.ExceptionListener l)

setStompFrameListener

public void setStompFrameListener(StompFrameListener l)

isConnected

public boolean isConnected()
Returns:
true if this Socket is started

isStarted

public boolean isStarted()
Returns:
true if this Socket is started

isStopping

public boolean isStopping()
Returns:
true if this socket is in the process of closing

isStopped

public boolean isStopped()
Returns:
true if this socket is stopped

sendFrame

public void sendFrame(StompFrame frame)
               throws java.io.IOException
A one way asynchronous send

Parameters:
frame -
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
pretty print of 'this'

run

public void run()
reads packets from a Socket

Specified by:
run in interface java.lang.Runnable

getSocketBufferSize

public int getSocketBufferSize()

setSocketBufferSize

public void setSocketBufferSize(int socketBufferSize)
Sets the buffer size to use on the socket

Parameters:
socketBufferSize -

getSoTimeout

public int getSoTimeout()

setSoTimeout

public void setSoTimeout(int soTimeout)
Sets the socket timeout

Parameters:
soTimeout -

getConnectionTimeout

public int getConnectionTimeout()

setConnectionTimeout

public void setConnectionTimeout(int connectionTimeout)
Sets the timeout used to connect to the socket

Parameters:
connectionTimeout -

getKeepAlive

public java.lang.Boolean getKeepAlive()

setKeepAlive

public void setKeepAlive(java.lang.Boolean keepAlive)
Enable/disable TCP KEEP_ALIVE mode

Parameters:
keepAlive -

getTcpNoDelay

public java.lang.Boolean getTcpNoDelay()

setTcpNoDelay

public void setTcpNoDelay(java.lang.Boolean tcpNoDelay)
Enable/disable the TCP_NODELAY option on the socket

Parameters:
tcpNoDelay -

getIoBufferSize

public int getIoBufferSize()
Returns:
the ioBufferSize

setIoBufferSize

public void setIoBufferSize(int ioBufferSize)
Parameters:
ioBufferSize - the ioBufferSize to set

connect

public void connect(java.lang.String userName,
                    java.lang.String password,
                    java.lang.String clientId)
             throws java.io.IOException
Configures the socket for use

Parameters:
userName -
password -
clientId -
Throws:
java.io.IOException

initialize

public void initialize()
                throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

start

public void start()
           throws java.io.IOException
Start receiving messages

Throws:
java.io.IOException

stop

public void stop()
          throws java.io.IOException
stop and close the socket

Throws:
java.io.IOException

getRemoteAddress

public java.lang.String getRemoteAddress()

parseContentLength

protected int parseContentLength(java.lang.String contentLength)
                          throws ProtocolException
Throws:
ProtocolException

parseHeaders

protected java.util.HashMap<java.lang.String,java.lang.String> parseHeaders(java.io.DataInput in)
                                                                     throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2010-2011 FuseSource, Corp.. All Rights Reserved.