RefObject
- is a reference object stored by this service. This is e reference to higher level data object
keeping more information about the connection.public abstract class IOService<RefObject> extends Object implements Callable<IOService<?>>, TLSEventHandler, IOListener
IOService
offers thread safe call()
method execution, however you must be prepared that
other methods can be called simultaneously like stop()
, getProtocol()
or
isConnected()
. AbsractServerService
rather
then implement ServerService
interface directly. If you directly implement
ServerService
interface you must take care about SocketChannel
I/O, queuing tasks,
processing results and thread safe execution of call()
method. If you however extend
IOService
class all this basic operation are implemented and you have only to take care about parsing
data received from network socket. Parsing data is expected to be implemented in parseData(char[] data)
method.
Created: Tue Sep 28 23:00:34 2004
Modifier and Type | Field and Description |
---|---|
protected CharBuffer |
cb |
static String |
CERT_CHECK_RESULT |
static String |
CERT_REQUIRED_DOMAIN |
protected CharsetDecoder |
decoder |
protected CharsetEncoder |
encoder |
static String |
HOSTNAME_KEY |
static String |
LOCAL_CERT_CHECK_RESULT |
protected byte[] |
partialCharacterBytes
The saved partial bytes for multi-byte UTF-8 characters between reads
|
static String |
PORT_TYPE_PROP_KEY |
static String |
SESSION_ID_KEY
This is key used to store session ID in temporary session data storage.
|
static String |
SSL_PROTOCOLS_KEY |
Constructor and Description |
---|
IOService() |
public static final String CERT_CHECK_RESULT
public static final String LOCAL_CERT_CHECK_RESULT
public static final String CERT_REQUIRED_DOMAIN
public static final String HOSTNAME_KEY
public static final String PORT_TYPE_PROP_KEY
public static final String SESSION_ID_KEY
public static final String SSL_PROTOCOLS_KEY
protected CharBuffer cb
protected CharsetDecoder decoder
protected CharsetEncoder encoder
protected byte[] partialCharacterBytes
public void accept(SocketChannel socketChannel) throws IOException
IOException
public IOService<?> call() throws IOException
call
in interface Callable<IOService<?>>
IOException
public boolean checkBufferLimit(int bufferSize)
checkBufferLimit
in interface IOListener
public ConnectionType connectionType()
public void forceStop()
public void handshakeCompleted(TLSWrapper wrapper)
handshakeCompleted
in interface TLSEventHandler
public abstract void processWaitingPackets() throws IOException
IOException
public void startSSL(boolean clientMode, boolean wantClientAuth, boolean needClientAuth) throws IOException
IOException
public CertificateContainerIfc getCertificateContainer()
public void setCertificateContainer(CertificateContainerIfc certificateContainer)
public void startTLS(boolean clientMode, boolean wantClientAuth, boolean needClientAuth) throws IOException
IOException
public void startZLib(int level)
public void stop()
public boolean waitingToRead()
public boolean waitingToSend()
public int waitingToSendSize()
public long getBuffOverflow(boolean reset)
public long getBytesReceived(boolean reset)
public long getBytesSent(boolean reset)
public JID getConnectionId()
public void setConnectionId(JID connectionId)
public JID getDataReceiver()
public void setDataReceiver(JID address)
public long getLastTransferTime()
public String getLocalAddress()
public byte[] getTlsUniqueId()
public int getLocalPort()
public long[] getReadCounters()
public RefObject getRefObject()
public void setRefObject(RefObject refObject)
public String getRemoteAddress()
public ConcurrentMap<String,Object> getSessionData()
public int getSocketInputSize()
getSocketInputSize
in interface TLSEventHandler
public SocketChannel getSocketChannel()
public void getStatistics(StatisticsList list, boolean reset)
public long getTotalBuffOverflow()
public long getTotalBytesReceived()
public long getTotalBytesSent()
public String getUniqueId()
public long[] getWriteCounters()
public boolean isConnected()
public void setBufferLimit(int bufferLimit)
public void setIOServiceListener(IOServiceListener<IOService<RefObject>> sl)
public void setSslContextContainer(SSLContextContainerIfc sslContextContainer)
public void setX509TrustManagers(TrustManager[] trustManager)
public Certificate getPeerCertificate()
public Certificate getLocalCertificate()
protected ByteOrder byteOrder()
protected boolean debug(char[] msg)
protected abstract void processSocketData() throws IOException
IOException
protected ByteBuffer readBytes() throws IOException
IOException
protected void readCompleted()
protected char[] readData() throws IOException
IOException
protected abstract int receivedPackets()
protected void writeBytes(ByteBuffer data)
protected void writeData(String data)
protected boolean isSocketServiceReady()
protected void setSocketServiceReady(boolean value)
protected boolean handleMalformedInput(ByteBuffer buffer, CharBuffer cb)
protected boolean isInputBufferEmpty()
protected IOInterface getIO()
Copyright © 2004–2020 "Tigase, Inc.". All rights reserved.