net.i2p.sam
Class SAMv3StreamSession
java.lang.Object
net.i2p.sam.SAMStreamSession
net.i2p.sam.SAMv3StreamSession
- All Implemented Interfaces:
- SAMv3Handler.Session
class SAMv3StreamSession
- extends SAMStreamSession
- implements SAMv3Handler.Session
SAMv3 STREAM session class.
- Author:
- mkvore
Constructor Summary |
SAMv3StreamSession(String login)
Create a new SAM STREAM session, according to information
registered with the given nickname |
Methods inherited from class net.i2p.sam.SAMStreamSession |
checkSocketHandlerId, closeConnection, connect, createSocketHandler, getDestination, getSocketReader, newSAMStreamSessionSocketReader, newStreamSender, removeSocketHandler, sendBytes, setReceiveLimit |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SAMv3StreamSession
public SAMv3StreamSession(String login)
throws IOException,
DataFormatException,
SAMException
- Create a new SAM STREAM session, according to information
registered with the given nickname
- Parameters:
login
- The nickname
- Throws:
IOException
DataFormatException
SAMException
NPE
- if login nickname is not registered
getNick
public String getNick()
- Specified by:
getNick
in interface SAMv3Handler.Session
getDB
public static SAMv3Handler.SessionsDB getDB()
connect
public void connect(SAMv3Handler handler,
String dest,
Properties props)
throws I2PException,
ConnectException,
NoRouteToHostException,
DataFormatException,
InterruptedIOException,
IOException
- Connect the SAM STREAM session to the specified Destination
for a single connection, using the socket stolen from the handler.
- Parameters:
handler
- The handler that communicates with the requesting clientdest
- Base64-encoded Destination to connect toprops
- Options to be used for connection
- Throws:
DataFormatException
- if the destination is not valid
ConnectException
- if the destination refuses connections
NoRouteToHostException
- if the destination can't be reached
InterruptedIOException
- if the connection timeouts
I2PException
- if there's another I2P-related error
IOException
accept
public void accept(SAMv3Handler handler,
boolean verbose)
throws I2PException,
InterruptedIOException,
IOException,
SAMException
- Accept a single incoming STREAM on the socket stolen from the handler.
- Parameters:
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 socket
- Throws:
DataFormatException
- if the destination is not valid
ConnectException
- if the destination refuses connections
NoRouteToHostException
- if the destination can't be reached
InterruptedIOException
- if the connection timeouts
I2PException
- if there's another I2P-related error
IOException
SAMException
startForwardingIncoming
public void startForwardingIncoming(Properties props)
throws SAMException,
InterruptedIOException
- Throws:
SAMException
InterruptedIOException
getSocketServer
public I2PServerSocket getSocketServer()
stopForwardingIncoming
public void stopForwardingIncoming()
throws SAMException,
InterruptedIOException
- stop Forwarding Incoming connection coming from I2P
- Throws:
SAMException
InterruptedIOException
close
public void close()
- Close the stream session
- Specified by:
close
in interface SAMv3Handler.Session
- Overrides:
close
in class SAMStreamSession
sendBytes
public boolean sendBytes(String s,
byte[] b)
throws DataFormatException
- Specified by:
sendBytes
in interface SAMv3Handler.Session
- Throws:
DataFormatException