public interface Session
Session
represents a session between client with SOCKS server.
This class is simple encapsulation of java.net.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) |
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. |
Socket getSocket()
void write(byte[] bytes) throws SocksException, IOException
bytes
- BytesSocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.void write(byte[] bytes, int offset, int length) throws SocksException, IOException
bytes
- Bytesoffset
- Offsetlength
- Bytes length.SocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.void write(WritableMessage message) throws SocksException, IOException
Message
in output stream.message
- WritableMessage
instance.SocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.int read(byte[] byetes) throws SocksException, IOException
byetes
- Buffer which read in.SocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.int read(ReadableMessage message) throws SocksException, IOException
message
- a readable message.SocksException
- If a SOCKS protocol error occurred.IOException
- If an I/O error occurred.long getId()
void close()
InputStream getInputStream()
OutputStream getOutputStream()
Map<Long,Session> getManagedSessions()
SocketAddress getRemoteAddress()
void clearAllAttributes()
boolean isClose()
true
if the session is closed.true
.boolean isConnected()
true
if the session is connected.true
.Copyright © 2015. All rights reserved.