Package tigase.socks5
Class Socks5IOService<RefObject>
- java.lang.Object
-
- tigase.net.IOService<RefObject>
-
- tigase.socks5.Socks5IOService<RefObject>
-
- All Implemented Interfaces:
Callable<tigase.net.IOService<?>>,tigase.io.TLSEventHandler,tigase.util.IOListener
public class Socks5IOService<RefObject> extends tigase.net.IOService<RefObject>- Author:
- andrzej
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSocks5IOService.StateAll possible states of Socks5 connection
-
Field Summary
Fields Modifier and Type Field Description protected ReentrantLocktransferInProgress
-
Constructor Summary
Constructors Constructor Description Socks5IOService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanactivate()Activate servicetigase.net.IOService<?>call()voidforceStop()intgetBytesReceived()Get all bytes received by this serviceintgetBytesSent()Get all bytes sent by this servicetigase.xmpp.JIDgetJID()Returns jid of client connected by this serviceSocks5ConnectionTypegetSocks5ConnectionType()Returns Socks5 connectionType (Requester/Target)Socks5IOService.StategetState()Returns current state of serviceinthashCode()Custom hashCode for better distribution Sender and recipient thread should be processed on same threadprotected voidprocessSocketData()Handles data from socketvoidprocessWaitingPackets()protected ByteBufferreadBytes()protected intreceivedPackets()voidsetConnectionManager(Socks5ConnectionManager manager)Set ConnectionManagervoidsetSocks5ConnectionType(Socks5ConnectionType connectionType)Set Socks5 connection type (Requester or Target connection)voidsetStream(Stream stream)Set stream assigned with this servicebooleanwaitingToRead()voidwriteBytes(ByteBuffer buf)protected voidwriteData(String data)-
Methods inherited from class tigase.net.IOService
accept, byteOrder, checkBufferLimit, connectionType, debug, debug, getBuffOverflow, getBytesReceived, getBytesSent, getConnectionId, getDataReceiver, getLastTransferTime, getLocalAddress, getLocalCertificate, getLocalPort, getPeerCertificate, getReadCounters, getRefObject, getRemoteAddress, getSessionData, getSocketChannel, getStatistics, getTlsUniqueId, getTotalBuffOverflow, getTotalBytesReceived, getTotalBytesSent, getUniqueId, getWriteCounters, getX509TrustManagers, handshakeCompleted, isConnected, isInputBufferEmpty, isSocketServiceReady, readCompleted, readData, setBufferLimit, setConnectionId, setDataReceiver, setIOServiceListener, setRefObject, setSessionData, setSocketServiceReady, setX509TrustManagers, startSSL, startTLS, startZLib, stop, toString, waitingToSend, waitingToSendSize
-
-
-
-
Field Detail
-
transferInProgress
protected final ReentrantLock transferInProgress
-
-
Method Detail
-
activate
public boolean activate()
Activate service- Returns:
-
setConnectionManager
public void setConnectionManager(Socks5ConnectionManager manager)
Set ConnectionManager- Parameters:
manager-
-
setStream
public void setStream(Stream stream)
Set stream assigned with this service- Parameters:
stream-
-
getJID
public tigase.xmpp.JID getJID()
Returns jid of client connected by this service- Returns:
-
getState
public Socks5IOService.State getState()
Returns current state of service- Returns:
-
setSocks5ConnectionType
public void setSocks5ConnectionType(Socks5ConnectionType connectionType)
Set Socks5 connection type (Requester or Target connection)- Parameters:
connectionType-
-
getSocks5ConnectionType
public Socks5ConnectionType getSocks5ConnectionType()
Returns Socks5 connectionType (Requester/Target)- Returns:
-
getBytesReceived
public int getBytesReceived()
Get all bytes received by this service- Returns:
-
getBytesSent
public int getBytesSent()
Get all bytes sent by this service- Returns:
-
processWaitingPackets
public void processWaitingPackets() throws IOException- Specified by:
processWaitingPacketsin classtigase.net.IOService<RefObject>- Throws:
IOException
-
waitingToRead
public boolean waitingToRead()
- Overrides:
waitingToReadin classtigase.net.IOService<RefObject>
-
call
public tigase.net.IOService<?> call() throws IOException- Specified by:
callin interfaceCallable<RefObject>- Overrides:
callin classtigase.net.IOService<RefObject>- Throws:
IOException
-
readBytes
protected ByteBuffer readBytes() throws IOException
- Overrides:
readBytesin classtigase.net.IOService<RefObject>- Throws:
IOException
-
writeBytes
public void writeBytes(ByteBuffer buf)
- Overrides:
writeBytesin classtigase.net.IOService<RefObject>
-
writeData
protected void writeData(String data)
- Overrides:
writeDatain classtigase.net.IOService<RefObject>
-
forceStop
public void forceStop()
- Overrides:
forceStopin classtigase.net.IOService<RefObject>
-
hashCode
public int hashCode()
Custom hashCode for better distribution Sender and recipient thread should be processed on same thread
-
processSocketData
protected void processSocketData() throws IOExceptionHandles data from socket- Specified by:
processSocketDatain classtigase.net.IOService<RefObject>- Throws:
IOException
-
receivedPackets
protected int receivedPackets()
- Specified by:
receivedPacketsin classtigase.net.IOService<RefObject>
-
-