public class SocketConnection extends Object implements Connection
Connection using the Apache
MINA framework. It uses a MINA IoSession to handle the
IO transport.| Modifier and Type | Method and Description |
|---|---|
void |
close()
Asynchronously closes this connection, freeing any resources
in use.
|
void |
filteredMessageReceived(org.apache.mina.common.ByteBuffer buf)
Dispatches a complete message to this connection's
ConnectionListener. |
void |
sendBytes(byte[] message)
Asynchronously sends data on this connection.
|
void |
sendUnfiltered(org.apache.mina.common.ByteBuffer buf)
Sends the given MINA buffer out on the associated
IoSession. |
public void sendBytes(byte[] message)
throws IOException
The specified byte array must not be modified after invoking this method; if the byte array is modified, then this method may have unpredictable results.
This implementation prepends the length of the given byte array as
a 4-byte int in network byte-order, and sends it out on
the underlying MINA IoSession.
sendBytes in interface Connectionmessage - the data to sendIOException - if the session is not connectedpublic void close()
throws IOException
disconnected is invoked
on the listener.
This implementation closes the underlying IoSession.
close in interface ConnectionIOException - if the session is not connectedpublic void filteredMessageReceived(org.apache.mina.common.ByteBuffer buf)
ConnectionListener.buf - a MINA ByteBuffer containing the message to dispatchpublic void sendUnfiltered(org.apache.mina.common.ByteBuffer buf)
IoSession.buf - the MINA ByteBuffer to sendCopyright © 2007-2013. All Rights Reserved.