class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handler.Session
SAMStreamSession.DisconnectListener, SAMStreamSession.SAMStreamSessionServer, SAMStreamSession.SAMStreamSessionSocketReader, SAMStreamSession.SAMv1StreamSessionSocketReader, SAMStreamSession.StreamSender
_log, canCreate, DEFAULT_FORCE_FLUSH, forceFlush, PROP_FORCE_FLUSH, recv, server, SOCKET_HANDLER_BUF_SIZE, socketMgr
Constructor and Description |
---|
SAMv3StreamSession(String login)
Create a new SAM STREAM session, according to information
registered with the given nickname
|
Modifier and Type | Method and Description |
---|---|
void |
accept(SAMv3Handler handler,
boolean verbose)
Accept an incoming STREAM
|
void |
close()
Close the stream session
|
void |
connect(SAMv3Handler handler,
String dest,
Properties props)
Connect the SAM STREAM session to the specified Destination
|
static SAMv3Handler.SessionsDB |
getDB() |
String |
getNick() |
I2PServerSocket |
getSocketServer() |
boolean |
sendBytes(String s,
byte[] b) |
void |
startForwardingIncoming(Properties props) |
void |
stopForwardingIncoming()
stop Forwarding Incoming connection coming from I2P
|
checkSocketHandlerId, closeConnection, connect, createSocketHandler, getDestination, getSocketReader, newSAMStreamSessionSocketReader, newStreamSender, removeSocketHandler, sendBytes, setReceiveLimit
public SAMv3StreamSession(String login) throws IOException, DataFormatException, SAMException
login
- The nicknameIOException
DataFormatException
SAMException
NPE
- if login nickname is not registeredpublic String getNick()
getNick
in interface SAMv3Handler.Session
public static SAMv3Handler.SessionsDB getDB()
public void connect(SAMv3Handler handler, String dest, Properties props) throws I2PException, ConnectException, NoRouteToHostException, DataFormatException, InterruptedIOException, IOException
handler
- The handler that communicates with the requesting clientdest
- Base64-encoded Destination to connect toprops
- Options to be used for connectionDataFormatException
- if the destination is not validConnectException
- if the destination refuses connectionsNoRouteToHostException
- if the destination can't be reachedInterruptedIOException
- if the connection timeoutsI2PException
- if there's another I2P-related errorIOException
public void accept(SAMv3Handler handler, boolean verbose) throws I2PException, InterruptedIOException, IOException, SAMException
handler
- The handler that communicates with the requesting clientverbose
- If true, SAM will send the Base64-encoded peer Destination of an
incoming socket as the first line of data sent to its client
on the handler socketDataFormatException
- if the destination is not validConnectException
- if the destination refuses connectionsNoRouteToHostException
- if the destination can't be reachedInterruptedIOException
- if the connection timeoutsI2PException
- if there's another I2P-related errorIOException
SAMException
public void startForwardingIncoming(Properties props) throws SAMException, InterruptedIOException
SAMException
InterruptedIOException
public I2PServerSocket getSocketServer()
public void stopForwardingIncoming() throws SAMException, InterruptedIOException
SAMException
InterruptedIOException
public void close()
close
in interface SAMv3Handler.Session
close
in class SAMStreamSession
public boolean sendBytes(String s, byte[] b) throws DataFormatException
sendBytes
in interface SAMv3Handler.Session
DataFormatException