Class Socks5BytestreamSession

java.lang.Object
org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession
All Implemented Interfaces:
BytestreamSession

public class Socks5BytestreamSession extends Object implements BytestreamSession
Socks5BytestreamSession class represents a SOCKS5 Bytestream session.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Socks5BytestreamSession(Socket socket, boolean isDirect)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the bytestream session.
    Returns the InputStream associated with this session to send data.
    Returns the OutputStream associated with this session to receive data.
    int
    Returns the timeout for read operations of the input stream associated with this session.
    boolean
    Returns true if the session is established through a direct connection between the initiator and target, false if the session is mediated over a SOCKS proxy.
    boolean
    Returns true if the session is mediated over a SOCKS proxy, false if this session is established through a direct connection between the initiator and target.
    void
    setReadTimeout(int timeout)
    Sets the specified timeout, in milliseconds.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • isDirect

      public boolean isDirect()
      Returns true if the session is established through a direct connection between the initiator and target, false if the session is mediated over a SOCKS proxy.
      Returns:
      true if session is a direct connection, false if session is mediated over a SOCKS5 proxy
    • isMediated

      public boolean isMediated()
      Returns true if the session is mediated over a SOCKS proxy, false if this session is established through a direct connection between the initiator and target.
      Returns:
      true if session is mediated over a SOCKS5 proxy, false if session is a direct connection
    • getInputStream

      Description copied from interface: BytestreamSession
      Returns the InputStream associated with this session to send data.
      Specified by:
      getInputStream in interface BytestreamSession
      Returns:
      the InputStream associated with this session to send data
      Throws:
      IOException - if an error occurs while retrieving the input stream
    • getOutputStream

      Description copied from interface: BytestreamSession
      Returns the OutputStream associated with this session to receive data.
      Specified by:
      getOutputStream in interface BytestreamSession
      Returns:
      the OutputStream associated with this session to receive data
      Throws:
      IOException - if an error occurs while retrieving the output stream
    • getReadTimeout

      public int getReadTimeout() throws IOException
      Description copied from interface: BytestreamSession
      Returns the timeout for read operations of the input stream associated with this session. 0 returns implies that the option is disabled (i.e., timeout of infinity). Default is 0.
      Specified by:
      getReadTimeout in interface BytestreamSession
      Returns:
      the timeout for read operations
      Throws:
      IOException - if there is an error in the underlying protocol
    • setReadTimeout

      public void setReadTimeout(int timeout) throws IOException
      Description copied from interface: BytestreamSession
      Sets the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on the input stream associated with this session will block for only this amount of time. If the timeout expires, a java.net.SocketTimeoutException is raised, though the session is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout. Default is 0.
      Specified by:
      setReadTimeout in interface BytestreamSession
      Parameters:
      timeout - the specified timeout, in milliseconds
      Throws:
      IOException - if there is an error in the underlying protocol
    • close

      public void close() throws IOException
      Description copied from interface: BytestreamSession
      Closes the bytestream session.

      Closing the session will also close the input stream and the output stream associated to this session.

      Specified by:
      close in interface BytestreamSession
      Throws:
      IOException - if an error occurs while closing the session