Constructor and Description |
---|
SocksSession() |
SocksSession(long id,
Socket socket,
Map<Long,Session> sessions) |
SocksSession(Socket socket) |
Modifier and Type | Method and Description |
---|---|
void |
clearAllAttributes()
Clear all attributes in session.
|
void |
close()
Closes connection.
|
Object |
getAttribute(Object key) |
Map<Object,Object> |
getAttributes()
Returns all attributes.
|
long |
getId()
Gets session ID.
|
InputStream |
getInputStream()
Gets input stream.
|
Map<Long,Session> |
getManagedSessions()
Gets all sessions that be managed.
|
OutputStream |
getOutputStream()
Gets output stream.
|
SocketAddress |
getRemoteAddress()
Get remote host's IP address and port.
|
Socket |
getSocket()
Gets socket.
|
boolean |
isClose()
Returns
true if the session is closed. |
boolean |
isConnected()
Returns
true if the session is connected. |
int |
read(byte[] byetes)
Read a buffer.
|
int |
read(ReadableMessage message)
Reads a message.
|
void |
setAttribute(Object key,
Object value) |
String |
toString() |
void |
write(byte[] bytes)
Writes bytes in output stream.
|
void |
write(byte[] bytes,
int offset,
int length)
Writes bytes in output stream.
|
void |
write(WritableMessage message)
Writes
Message in output stream. |
public SocksSession()
public SocksSession(Socket socket)
public void write(byte[] bytes) throws SocksException, IOException
Session
write
in interface Session
bytes
- BytesSocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.public void write(WritableMessage message) throws SocksException, IOException
Session
Message
in output stream.write
in interface Session
message
- WritableMessage
instance.SocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.public int read(byte[] byetes) throws SocksException, IOException
Session
read
in interface Session
byetes
- Buffer which read in.SocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.public int read(ReadableMessage message) throws SocksException, IOException
Session
read
in interface Session
message
- a readable message.SocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.public long getId()
Session
public void close()
Session
public InputStream getInputStream()
Session
getInputStream
in interface Session
public OutputStream getOutputStream()
Session
getOutputStream
in interface Session
public void write(byte[] bytes, int offset, int length) throws SocksException, IOException
Session
write
in interface Session
bytes
- Bytesoffset
- Offsetlength
- Bytes length.SocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.public Map<Long,Session> getManagedSessions()
Session
getManagedSessions
in interface Session
public SocketAddress getRemoteAddress()
Session
getRemoteAddress
in interface Session
public void setAttribute(Object key, Object value)
setAttribute
in interface Session
public Object getAttribute(Object key)
getAttribute
in interface Session
public Map<Object,Object> getAttributes()
Session
getAttributes
in interface Session
public void clearAllAttributes()
Session
clearAllAttributes
in interface Session
public boolean isClose()
Session
true
if the session is closed.public boolean isConnected()
Session
true
if the session is connected.isConnected
in interface Session
true
.Copyright © 2015. All rights reserved.