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 enum 
    All possible states of Socks5 connection
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final ReentrantLock
     

    Fields inherited from class tigase.net.IOService

    cb, CERT_CHECK_RESULT, CERT_REQUIRED_DOMAIN, decoder, encoder, HOSTNAME_KEY, LOCAL_CERT_CHECK_RESULT, partialCharacterBytes, PORT_TYPE_PROP_KEY, SESSION_ID_KEY, SSL_PROTOCOLS_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Activate service
    tigase.net.IOService<?>
     
    void
     
    int
    Get all bytes received by this service
    int
    Get all bytes sent by this service
    tigase.xmpp.jid.JID
    Returns jid of client connected by this service
    Returns Socks5 connectionType (Requester/Target)
    Returns current state of service
    int
    Custom hashCode for better distribution Sender and recipient thread should be processed on same thread
    protected void
    Handles data from socket
    void
     
    protected ByteBuffer
     
    protected int
     
    void
    Set ConnectionManager
    void
    Set Socks5 connection type (Requester or Target connection)
    void
    setStream(Stream stream)
    Set stream assigned with this service
    boolean
     
    void
     
    protected void
     

    Methods inherited from class tigase.net.IOService

    accept, byteOrder, checkBufferLimit, connectionType, debug, debug, getBuffOverflow, getBytesReceived, getBytesSent, getCertificateContainer, getConnectionId, getDataReceiver, getIO, getLastTransferTime, getLocalAddress, getLocalCertificate, getLocalPort, getPeerCertificate, getReadCounters, getRefObject, getRemoteAddress, getSessionData, getSocketChannel, getSocketInputSize, getStatistics, getTlsUniqueId, getTotalBuffOverflow, getTotalBytesReceived, getTotalBytesSent, getUniqueId, getWriteCounters, handleMalformedInput, handshakeCompleted, isConnected, isInputBufferEmpty, isSocketServiceReady, readCompleted, readData, setBufferLimit, setCertificateContainer, setConnectionId, setDataReceiver, setIOServiceListener, setRefObject, setSessionData, setSocketServiceReady, setSslContextContainer, setX509TrustManagers, startSSL, startTLS, startZLib, stop, toString, waitingToSend, waitingToSendSize

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • transferInProgress

      protected final ReentrantLock transferInProgress
  • Constructor Details

    • Socks5IOService

      public Socks5IOService()
  • Method Details

    • 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.JID getJID()
      Returns jid of client connected by this service
      Returns:
    • getState

      public Socks5IOService.State getState()
      Returns current state of service
      Returns:
    • getSocks5ConnectionType

      public Socks5ConnectionType getSocks5ConnectionType()
      Returns Socks5 connectionType (Requester/Target)
      Returns:
    • setSocks5ConnectionType

      public void setSocks5ConnectionType(Socks5ConnectionType connectionType)
      Set Socks5 connection type (Requester or Target connection)
      Parameters:
      connectionType -
    • 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:
      processWaitingPackets in class tigase.net.IOService<RefObject>
      Throws:
      IOException
    • waitingToRead

      public boolean waitingToRead()
      Overrides:
      waitingToRead in class tigase.net.IOService<RefObject>
    • call

      public tigase.net.IOService<?> call() throws IOException
      Specified by:
      call in interface Callable<RefObject>
      Overrides:
      call in class tigase.net.IOService<RefObject>
      Throws:
      IOException
    • writeBytes

      public void writeBytes(ByteBuffer buf)
      Overrides:
      writeBytes in class tigase.net.IOService<RefObject>
    • forceStop

      public void forceStop()
      Overrides:
      forceStop in class tigase.net.IOService<RefObject>
    • hashCode

      public int hashCode()
      Custom hashCode for better distribution Sender and recipient thread should be processed on same thread
      Overrides:
      hashCode in class Object
      Returns:
    • readBytes

      protected ByteBuffer readBytes() throws IOException
      Overrides:
      readBytes in class tigase.net.IOService<RefObject>
      Throws:
      IOException
    • writeData

      protected void writeData(String data)
      Overrides:
      writeData in class tigase.net.IOService<RefObject>
    • processSocketData

      protected void processSocketData() throws IOException
      Handles data from socket
      Specified by:
      processSocketData in class tigase.net.IOService<RefObject>
      Throws:
      IOException
    • receivedPackets

      protected int receivedPackets()
      Specified by:
      receivedPackets in class tigase.net.IOService<RefObject>