public class Socks5BytestreamSession extends java.lang.Object implements BytestreamSession
Modifier | Constructor and Description |
---|---|
protected |
Socks5BytestreamSession(java.net.Socket socket,
boolean isDirect) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the bytestream session.
|
java.io.InputStream |
getInputStream()
Returns the InputStream associated with this session to send data.
|
java.io.OutputStream |
getOutputStream()
Returns the OutputStream associated with this session to receive data.
|
int |
getReadTimeout()
Returns the timeout for read operations of the input stream associated with this session.
|
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. |
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. |
void |
setReadTimeout(int timeout)
Sets the specified timeout, in milliseconds.
|
protected Socks5BytestreamSession(java.net.Socket socket, boolean isDirect)
public boolean isDirect()
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.true
if session is a direct connection, false
if session is
mediated over a SOCKS5 proxypublic boolean isMediated()
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.true
if session is mediated over a SOCKS5 proxy, false
if
session is a direct connectionpublic java.io.InputStream getInputStream() throws java.io.IOException
BytestreamSession
getInputStream
in interface BytestreamSession
java.io.IOException
- if an error occurs while retrieving the input streampublic java.io.OutputStream getOutputStream() throws java.io.IOException
BytestreamSession
getOutputStream
in interface BytestreamSession
java.io.IOException
- if an error occurs while retrieving the output streampublic int getReadTimeout() throws java.io.IOException
BytestreamSession
getReadTimeout
in interface BytestreamSession
java.io.IOException
- if there is an error in the underlying protocolpublic void setReadTimeout(int timeout) throws java.io.IOException
BytestreamSession
setReadTimeout
in interface BytestreamSession
timeout
- the specified timeout, in millisecondsjava.io.IOException
- if there is an error in the underlying protocolpublic void close() throws java.io.IOException
BytestreamSession
Closing the session will also close the input stream and the output stream associated to this session.
close
in interface BytestreamSession
java.io.IOException
- if an error occurs while closing the session