Class Socks5BytestreamSession
- java.lang.Object
-
- org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession
-
- All Implemented Interfaces:
BytestreamSession
public class Socks5BytestreamSession extends java.lang.Object implements BytestreamSession
Socks5BytestreamSession class represents a SOCKS5 Bytestream session.
-
-
Constructor Summary
Constructors Constructor Description Socks5BytestreamSession(java.net.Socket socket, boolean isDirect)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the bytestream session.java.io.InputStreamgetInputStream()Returns the InputStream associated with this session to send data.java.io.OutputStreamgetOutputStream()Returns the OutputStream associated with this session to receive data.intgetReadTimeout()Returns the timeout for read operations of the input stream associated with this session.booleanisDirect()Returnstrueif the session is established through a direct connection between the initiator and target,falseif the session is mediated over a SOCKS proxy.booleanisMediated()Returnstrueif the session is mediated over a SOCKS proxy,falseif this session is established through a direct connection between the initiator and target.voidsetReadTimeout(int timeout)Sets the specified timeout, in milliseconds.
-
-
-
Constructor Detail
-
Socks5BytestreamSession
public Socks5BytestreamSession(java.net.Socket socket, boolean isDirect)
-
-
Method Detail
-
isDirect
public boolean isDirect()
Returnstrueif the session is established through a direct connection between the initiator and target,falseif the session is mediated over a SOCKS proxy.- Returns:
trueif session is a direct connection,falseif session is mediated over a SOCKS5 proxy
-
isMediated
public boolean isMediated()
Returnstrueif the session is mediated over a SOCKS proxy,falseif this session is established through a direct connection between the initiator and target.- Returns:
trueif session is mediated over a SOCKS5 proxy,falseif session is a direct connection
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
Description copied from interface:BytestreamSessionReturns the InputStream associated with this session to send data.- Specified by:
getInputStreamin interfaceBytestreamSession- Returns:
- the InputStream associated with this session to send data
- Throws:
java.io.IOException- if an error occurs while retrieving the input stream
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException
Description copied from interface:BytestreamSessionReturns the OutputStream associated with this session to receive data.- Specified by:
getOutputStreamin interfaceBytestreamSession- Returns:
- the OutputStream associated with this session to receive data
- Throws:
java.io.IOException- if an error occurs while retrieving the output stream
-
getReadTimeout
public int getReadTimeout() throws java.io.IOException
Description copied from interface:BytestreamSessionReturns 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:
getReadTimeoutin interfaceBytestreamSession- Returns:
- the timeout for read operations
- Throws:
java.io.IOException- if there is an error in the underlying protocol
-
setReadTimeout
public void setReadTimeout(int timeout) throws java.io.IOException
Description copied from interface:BytestreamSessionSets 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:
setReadTimeoutin interfaceBytestreamSession- Parameters:
timeout- the specified timeout, in milliseconds- Throws:
java.io.IOException- if there is an error in the underlying protocol
-
close
public void close() throws java.io.IOException
Description copied from interface:BytestreamSessionCloses the bytestream session.Closing the session will also close the input stream and the output stream associated to this session.
- Specified by:
closein interfaceBytestreamSession- Throws:
java.io.IOException- if an error occurs while closing the session
-
-