org.xsocket.stream
Interface IBlockingConnection

Package class diagram package IBlockingConnection
All Superinterfaces:
java.nio.channels.Channel, java.io.Closeable, java.io.Flushable, java.nio.channels.GatheringByteChannel, IConnection, IDataSink, IDataSource, java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel
All Known Implementing Classes:
BlockingConnection

public interface IBlockingConnection
extends IConnection

A connection which uses the underlying channel in a blocking manner. Every I/O operation will block until it completes.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.xsocket.stream.IConnection
IConnection.FlushMode
 
Field Summary
static long INITIAL_RECEIVE_TIMEOUT
           
 
Fields inherited from interface org.xsocket.stream.IConnection
INITIAL_AUTOFLUSH, INITIAL_DEFAULT_ENCODING, SO_KEEPALIVE, SO_LINGER, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, TCP_NODELAY
 
Method Summary
 void flush()
          flush the send buffer.
 int getIndexOf(java.lang.String str)
          Returns the index of the first occurrence of the given string.
 int getIndexOf(java.lang.String str, int maxLength)
          Returns the index of the first occurrence of the given string.
 byte readByte()
          receive a byte. the method will block, until data is available
 java.nio.ByteBuffer[] readByteBufferByDelimiter(java.lang.String delimiter)
          receive a ByteBuffer. the method will block, until the delimiter has been read.
 java.nio.ByteBuffer[] readByteBufferByDelimiter(java.lang.String delimiter, int maxLength)
          receive a ByteBuffer. the method will block, until the delimiter has been read.
 java.nio.ByteBuffer[] readByteBufferByLength(int length)
          receive a ByteBuffer. the method will block, until the required amount of bytes has been received For performance reasons, the ByteBuffer receiveByteBuffer method is generally preferable to get bytes
 byte[] readBytesByDelimiter(java.lang.String delimiter)
          receive a byte array. the method will block, until the delimiter has been read.
 byte[] readBytesByDelimiter(java.lang.String delimiter, int maxLength)
          receive a byte array. the method will block, until the delimiter has been read.
 byte[] readBytesByLength(int length)
          receive a byte array. the method will block, until the required amount of bytes has been received For performance reasons, the ByteBuffer receiveByteBuffer method is generally preferable to get bytes
 double readDouble()
          receive a double. the method will block, until data is available
 int readInt()
          receive an int. the method will block, until data is available
 long readLong()
          receive a long. the method will block, until data is available
 java.lang.String readStringByDelimiter(java.lang.String delimiter)
          receive a string. the method will block, until the delimiter has been read.
 java.lang.String readStringByDelimiter(java.lang.String delimiter, int maxLength)
          receive a string. the method will block, until the delimiter has been read.
 java.lang.String readStringByDelimiter(java.lang.String delimiter, java.lang.String encoding)
          receive a string. the method will block, until the delimiter has been read To avoid memory leaks the readStringByDelimiter(String, String) method is generally preferable
 java.lang.String readStringByDelimiter(java.lang.String delimiter, java.lang.String encoding, int maxLength)
          receive a string. the method will block, until the delimiter has been read
 java.lang.String readStringByLength(int length)
          receive a string.
 java.lang.String readStringByLength(int length, java.lang.String encoding)
          receive a string.
 IBlockingConnection setOption(java.lang.String name, java.lang.Object value)
          sets the value of a option
 void setReceiveTimeoutMillis(long timeout)
          set the timeout for calling read methods in millis
 int write(byte... bytes)
          sends bytes to the remote endpoint
 int write(byte b)
          sends a byte to the remote endpoint
 int write(byte[] bytes, int offset, int length)
          sends bytes to the remote endpoint
 int write(java.nio.ByteBuffer buffer)
          sends a byte buffer to the remote endpoint
 long write(java.nio.ByteBuffer[] buffers)
          sends an array of byte buffer to the remote endpoint
 int write(double d)
          sends a double to the remote endpoint
 int write(int i)
          sends an int to the remote endpoint
 int write(long l)
          sends a long to the remote endpoint
 int write(java.lang.String message)
          sends a message to the remote endpoint by using the connection default encoding
 int write(java.lang.String message, java.lang.String encoding)
          sends a message to the remote endpoint
 
Methods inherited from interface org.xsocket.stream.IConnection
activateSecuredMode, attach, attachment, getAttachment, getAutoflush, getConnectionTimeoutSec, getDefaultEncoding, getId, getIdleTimeoutSec, getIndexOf, getLocalAddress, getLocalPort, getOption, getOptions, getPendingWriteDataSize, getRemoteAddress, getRemotePort, isOpen, markReadPosition, markWritePosition, readByteBufferByDelimiter, readBytesByDelimiter, removeReadMark, removeWriteMark, resetToReadMark, resetToWriteMark, resumeRead, setAttachment, setAutoflush, setConnectionTimeoutSec, setDefaultEncoding, setIdleTimeoutSec, suspendRead
 
Methods inherited from interface org.xsocket.IDataSource
readShort
 
Methods inherited from interface org.xsocket.IDataSink
write
 
Methods inherited from interface java.nio.channels.GatheringByteChannel
write
 
Methods inherited from interface java.nio.channels.Channel
close
 
Methods inherited from interface java.nio.channels.ReadableByteChannel
read
 

Field Detail

INITIAL_RECEIVE_TIMEOUT

static final long INITIAL_RECEIVE_TIMEOUT
See Also:
Constant Field Values
Method Detail

setReceiveTimeoutMillis

void setReceiveTimeoutMillis(long timeout)
set the timeout for calling read methods in millis

Parameters:
timeout - the timeout in millis

readStringByDelimiter

java.lang.String readStringByDelimiter(java.lang.String delimiter)
                                       throws java.io.IOException,
                                              ClosedConnectionException,
                                              java.io.UnsupportedEncodingException,
                                              java.net.SocketTimeoutException
receive a string. the method will block, until the delimiter has been read. For the encoding the default encoding of the connection will be used. To avoid memory leaks the readStringByDelimiter(String, int) method is generally preferable

Specified by:
readStringByDelimiter in interface IConnection
Specified by:
readStringByDelimiter in interface IDataSource
Parameters:
delimiter - the delimiter
Returns:
the string
Throws:
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached
java.io.UnsupportedEncodingException - if the default encoding is not supported

readStringByDelimiter

java.lang.String readStringByDelimiter(java.lang.String delimiter,
                                       int maxLength)
                                       throws java.io.IOException,
                                              ClosedConnectionException,
                                              java.io.UnsupportedEncodingException,
                                              java.net.SocketTimeoutException,
                                              MaxReadSizeExceededException
receive a string. the method will block, until the delimiter has been read. For the encoding the default encoding of the connection will be used

Specified by:
readStringByDelimiter in interface IConnection
Specified by:
readStringByDelimiter in interface IDataSource
Parameters:
delimiter - the delimiter
maxLength - the max length of bytes that should be read. If the limit is exceeded a MaxReadSizeExceededException will been thrown
Returns:
the string
Throws:
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached
java.io.UnsupportedEncodingException - if the default encoding is not supported

readStringByDelimiter

java.lang.String readStringByDelimiter(java.lang.String delimiter,
                                       java.lang.String encoding)
                                       throws java.io.IOException,
                                              ClosedConnectionException,
                                              java.io.UnsupportedEncodingException,
                                              java.net.SocketTimeoutException
receive a string. the method will block, until the delimiter has been read To avoid memory leaks the readStringByDelimiter(String, String) method is generally preferable

Specified by:
readStringByDelimiter in interface IConnection
Parameters:
delimiter - the delimiter
encoding - the encoding to use
Returns:
the string
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
java.io.IOException - If some other I/O error occurs
java.io.UnsupportedEncodingException - If the given encoding is not supported
ClosedConnectionException - If the underlying socket is already closed

readStringByDelimiter

java.lang.String readStringByDelimiter(java.lang.String delimiter,
                                       java.lang.String encoding,
                                       int maxLength)
                                       throws java.io.IOException,
                                              ClosedConnectionException,
                                              java.io.UnsupportedEncodingException,
                                              java.net.SocketTimeoutException,
                                              MaxReadSizeExceededException
receive a string. the method will block, until the delimiter has been read

Specified by:
readStringByDelimiter in interface IConnection
Specified by:
readStringByDelimiter in interface IDataSource
Parameters:
delimiter - the delimiter
encoding - the encoding to use
maxLength - the max length of bytes that should be read. If the limit is exceeded a MaxReadSizeExceededException will been thrown
Returns:
the string
Throws:
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found * @throws ClosedConnectionException If the underlying socket is already closed
java.net.SocketTimeoutException - If the receive timeout has been reached
java.io.IOException - If some other I/O error occurs
java.io.UnsupportedEncodingException - If the given encoding is not supported
ClosedConnectionException - If the underlying socket is already closed

readStringByLength

java.lang.String readStringByLength(int length)
                                    throws java.io.IOException,
                                           ClosedConnectionException,
                                           java.net.SocketTimeoutException
receive a string. the method will block, until the required amount of bytes has been received

Specified by:
readStringByLength in interface IConnection
Specified by:
readStringByLength in interface IDataSource
Parameters:
length - the number of bytes to read
Returns:
the received string
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readStringByLength

java.lang.String readStringByLength(int length,
                                    java.lang.String encoding)
                                    throws java.io.IOException,
                                           ClosedConnectionException,
                                           java.net.SocketTimeoutException
receive a string. the method will block, until the required amount of bytes has been received For performance reasons, the ByteBuffer receiveRecord method is generally preferable to get bytes

Specified by:
readStringByLength in interface IConnection
Specified by:
readStringByLength in interface IDataSource
Parameters:
length - the number of bytes to read
encoding - the encoding
Returns:
the received string
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readByteBufferByDelimiter

java.nio.ByteBuffer[] readByteBufferByDelimiter(java.lang.String delimiter)
                                                throws java.io.IOException,
                                                       ClosedConnectionException,
                                                       java.net.SocketTimeoutException
receive a ByteBuffer. the method will block, until the delimiter has been read. To avoid memory leaks the readByteBufferByDelimiter(String, int) method is generally preferable
For performance reasons, the ByteBuffer receiveByteBuffer method is generally preferable to get bytes

Specified by:
readByteBufferByDelimiter in interface IConnection
Parameters:
delimiter - the delimiter
Returns:
the ByteBuffer
Throws:
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readByteBufferByDelimiter

java.nio.ByteBuffer[] readByteBufferByDelimiter(java.lang.String delimiter,
                                                int maxLength)
                                                throws java.io.IOException,
                                                       ClosedConnectionException,
                                                       java.net.SocketTimeoutException,
                                                       MaxReadSizeExceededException
receive a ByteBuffer. the method will block, until the delimiter has been read. For performance reasons, the ByteBuffer receiveByteBuffer method is generally preferable to get bytes

Specified by:
readByteBufferByDelimiter in interface IConnection
Parameters:
delimiter - the delimiter
maxLength - the max length of bytes that should be read. If the limit is exceeded a MaxReadSizeExceededException will been thrown
Returns:
the ByteBuffer
Throws:
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readByteBufferByLength

java.nio.ByteBuffer[] readByteBufferByLength(int length)
                                             throws java.io.IOException,
                                                    ClosedConnectionException,
                                                    java.net.SocketTimeoutException
receive a ByteBuffer. the method will block, until the required amount of bytes has been received For performance reasons, the ByteBuffer receiveByteBuffer method is generally preferable to get bytes

Specified by:
readByteBufferByLength in interface IConnection
Parameters:
length - the number of bytes to read
Returns:
the received ByteBuffer
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readBytesByDelimiter

byte[] readBytesByDelimiter(java.lang.String delimiter)
                            throws java.io.IOException,
                                   ClosedConnectionException,
                                   java.net.SocketTimeoutException
receive a byte array. the method will block, until the delimiter has been read. To avoid memory leaks the readBytesByDelimiter(String, int) method is generally preferable
For performance reasons, the ByteBuffer receiveByteBuffer method is generally preferable to get bytes

Specified by:
readBytesByDelimiter in interface IConnection
Parameters:
delimiter - the delimiter
Returns:
the read bytes
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readBytesByDelimiter

byte[] readBytesByDelimiter(java.lang.String delimiter,
                            int maxLength)
                            throws java.io.IOException,
                                   ClosedConnectionException,
                                   java.net.SocketTimeoutException,
                                   MaxReadSizeExceededException
receive a byte array. the method will block, until the delimiter has been read. For performance reasons, the ByteBuffer receiveByteBuffer method is generally preferable to get bytes

Specified by:
readBytesByDelimiter in interface IConnection
Specified by:
readBytesByDelimiter in interface IDataSource
Parameters:
delimiter - the delimiter
maxLength - the max length of bytes that should be read. If the limit is exceeded a MaxReadSizeExceededException will been thrown
Returns:
the read bytes
Throws:
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

getIndexOf

int getIndexOf(java.lang.String str)
               throws java.io.IOException,
                      ClosedConnectionException,
                      java.net.SocketTimeoutException
Returns the index of the first occurrence of the given string.

Specified by:
getIndexOf in interface IConnection
Parameters:
str - any string
Returns:
if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned;
Throws:
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached

getIndexOf

int getIndexOf(java.lang.String str,
               int maxLength)
               throws java.io.IOException,
                      ClosedConnectionException,
                      MaxReadSizeExceededException,
                      java.net.SocketTimeoutException
Returns the index of the first occurrence of the given string.

Specified by:
getIndexOf in interface IConnection
Parameters:
str - any string
maxLength - the max length of bytes that should be read. If the limit is exceeded a MaxReadSizeExceededException will been thrown
Returns:
if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned;
Throws:
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
java.net.SocketTimeoutException - If the receive timeout has been reached

readBytesByLength

byte[] readBytesByLength(int length)
                         throws java.io.IOException,
                                ClosedConnectionException,
                                java.net.SocketTimeoutException
receive a byte array. the method will block, until the required amount of bytes has been received For performance reasons, the ByteBuffer receiveByteBuffer method is generally preferable to get bytes

Specified by:
readBytesByLength in interface IConnection
Specified by:
readBytesByLength in interface IDataSource
Parameters:
length - the number of bytes to read
Returns:
the received byte array
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readInt

int readInt()
            throws java.io.IOException,
                   ClosedConnectionException,
                   java.net.SocketTimeoutException
receive an int. the method will block, until data is available

Specified by:
readInt in interface IConnection
Specified by:
readInt in interface IDataSource
Returns:
the received int
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readLong

long readLong()
              throws java.io.IOException,
                     ClosedConnectionException,
                     java.net.SocketTimeoutException
receive a long. the method will block, until data is available

Specified by:
readLong in interface IConnection
Specified by:
readLong in interface IDataSource
Returns:
the received long
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readDouble

double readDouble()
                  throws java.io.IOException,
                         ClosedConnectionException,
                         java.net.SocketTimeoutException
receive a double. the method will block, until data is available

Specified by:
readDouble in interface IConnection
Specified by:
readDouble in interface IDataSource
Returns:
the received double
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

readByte

byte readByte()
              throws java.io.IOException,
                     ClosedConnectionException,
                     java.net.SocketTimeoutException
receive a byte. the method will block, until data is available

Specified by:
readByte in interface IConnection
Specified by:
readByte in interface IDataSource
Returns:
the received byte
Throws:
java.net.SocketTimeoutException - If the receive timeout has been reached
ClosedConnectionException - If the underlying socket is already closed
java.io.IOException - If some other I/O error occurs

write

int write(java.lang.String message,
          java.lang.String encoding)
          throws ClosedConnectionException,
                 java.io.IOException,
                 java.net.SocketTimeoutException
sends a message to the remote endpoint

Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Parameters:
message - the message to send
encoding - the encoding which should be used th encode the chars into byte (e.g. `US-ASCII` or `UTF-8`)
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

write

int write(java.lang.String message)
          throws ClosedConnectionException,
                 java.io.IOException,
                 java.net.SocketTimeoutException
sends a message to the remote endpoint by using the connection default encoding

Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Parameters:
message - the message to send
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

write

int write(byte b)
          throws ClosedConnectionException,
                 java.io.IOException,
                 java.net.SocketTimeoutException
sends a byte to the remote endpoint

Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Parameters:
b - the byte to send
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

write

int write(byte... bytes)
          throws ClosedConnectionException,
                 java.io.IOException,
                 java.net.SocketTimeoutException
sends bytes to the remote endpoint

Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Parameters:
bytes - the bytes to send
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

write

int write(byte[] bytes,
          int offset,
          int length)
          throws ClosedConnectionException,
                 java.io.IOException,
                 java.net.SocketTimeoutException
sends bytes to the remote endpoint

Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Parameters:
bytes - the bytes to send
offset - The offset of the subarray to be used; must be non-negative and no larger than array.length. The new buffer`s position will be set to this value.
length - The length of the subarray to be used; must be non-negative and no larger than array.length - offset. The new buffer`s limit will be set to offset + length.
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

write

int write(java.nio.ByteBuffer buffer)
          throws ClosedConnectionException,
                 java.io.IOException,
                 java.net.SocketTimeoutException
sends a byte buffer to the remote endpoint

Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Specified by:
write in interface java.nio.channels.WritableByteChannel
Parameters:
buffer - the bytes to send
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

write

long write(java.nio.ByteBuffer[] buffers)
           throws ClosedConnectionException,
                  java.io.IOException,
                  java.net.SocketTimeoutException
sends an array of byte buffer to the remote endpoint

Specified by:
write in interface java.nio.channels.GatheringByteChannel
Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Parameters:
buffers - the bytes to send
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

write

int write(int i)
          throws ClosedConnectionException,
                 java.io.IOException,
                 java.net.SocketTimeoutException
sends an int to the remote endpoint

Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Parameters:
i - the int value to send
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

write

int write(long l)
          throws ClosedConnectionException,
                 java.io.IOException,
                 java.net.SocketTimeoutException
sends a long to the remote endpoint

Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Parameters:
l - the int value to send
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

write

int write(double d)
          throws ClosedConnectionException,
                 java.io.IOException,
                 java.net.SocketTimeoutException
sends a double to the remote endpoint

Specified by:
write in interface IConnection
Specified by:
write in interface IDataSink
Parameters:
d - the int value to send
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the receive timeout has been reached (will only been thrown if autoflush = true)
ClosedConnectionException - if the underlying channel is closed

flush

void flush()
           throws ClosedConnectionException,
                  java.io.IOException,
                  java.net.SocketTimeoutException
flush the send buffer. The method call will block until the outgoing data has been flushed into the underlying os-specific send buffer.

Specified by:
flush in interface java.io.Flushable
Specified by:
flush in interface IConnection
Throws:
java.io.IOException - If some other I/O error occurs
java.net.SocketTimeoutException - If the timeout has been reached
ClosedConnectionException - if the underlying channel is closed

setOption

IBlockingConnection setOption(java.lang.String name,
                              java.lang.Object value)
                              throws java.io.IOException
sets the value of a option

Specified by:
setOption in interface IConnection
Parameters:
name - the name of the option
value - the value of the option
Returns:
the IConnection
Throws:
java.io.IOException - In an I/O error occurs