Saros
Distributed Collaborative Editing and Distributed Party Programming
|
Classes | |
class | WrappedBidirectionalSocks5BytestreamSession |
Public Member Functions | |
ConnectionMode | getNetTransferMode () |
void | initialize (Connection connection, IByteStreamConnectionListener listener) |
void | uninitialize () |
String | toString () |
Protected Member Functions | |
Future< Socks5BytestreamSession > | futureToEstablishResponseSession (final String sessionID, final String peer) |
void | waitToCloseResponse (final Future< Socks5BytestreamSession > future) |
String | verboseLocalProxyInfo () |
BytestreamSession | testAndGetMediatedBidirectionalBytestream (Socks5BytestreamSession inSession, Socks5BytestreamSession outSession, boolean preferInSession) throws IOException |
boolean | streamIsBidirectional (Socks5BytestreamSession session, boolean sendFirst) throws IOException |
void | handleResponse (BytestreamRequest request) throws XMPPException, InterruptedException |
IByteStreamConnection | acceptNewRequest (BytestreamRequest request) throws XMPPException, IOException, InterruptedException |
IByteStreamConnection | acceptRequest (BytestreamRequest request) throws XMPPException, IOException, InterruptedException |
IByteStreamConnection | establishBinaryChannel (String connectionIdentifier, String peer) throws XMPPException, IOException, InterruptedException |
BytestreamSession | establishResponseSession (String sessionID, String peer) throws XMPPException, IOException, InterruptedException |
BytestreamManager | createManager (Connection connection) |
Transport class for SOCKS5 bytestreams. When a Request is received always it is tried to establish a connection to the side peer, too. A special ID is used to distinguish connect requests and response requests. If there is a direct connection, we keep it, the other one discarded. If the is no one, a SMACK will establish a mediated connection by the server.
Are both connection direct, we use the one of the connect request (same for mediated).
However, still there might be a server that only supports unidirectional SOCKS5 bytestreams (i.e. OpenFire). In that case both mediated unidirectional connections are wrapped into a bidirectional one. (see {#link WrappedBidirectionalSocks5BytestreamSession})
IByteStreamConnection de.fu_berlin.inf.dpp.net.internal.Socks5Transport.acceptNewRequest | ( | BytestreamRequest | request | ) | throws XMPPException, IOException, InterruptedException [protected] |
Accepts a Request and returns an established IByteStreamConnection.
Immediately tries to establish a second session to the requesting peer but also accepts this request to achieve a direct connection although one peer might be behind a NAT.
A direct connection is used, the other discarded where the requesting session is preferred.
In case of unidirectional connections both sessions a wrapped into a bidirectional one.
request |
XMPPException | |
InterruptedException | |
IOException |
IByteStreamConnection de.fu_berlin.inf.dpp.net.internal.Socks5Transport.acceptRequest | ( | BytestreamRequest | request | ) | throws XMPPException, IOException, InterruptedException [protected] |
Handles the SOCKS5Bytestream Request and distinguishes between connect requests and response requests.
see handleResponse() and acceptNewRequest()
Reimplemented from de.fu_berlin.inf.dpp.net.internal.ByteStreamTransport.
BytestreamManager de.fu_berlin.inf.dpp.net.internal.Socks5Transport.createManager | ( | Connection | connection | ) | [protected, virtual] |
connection |
Implements de.fu_berlin.inf.dpp.net.internal.ByteStreamTransport.
IByteStreamConnection de.fu_berlin.inf.dpp.net.internal.Socks5Transport.establishBinaryChannel | ( | String | connectionIdentifier, |
String | peer | ||
) | throws XMPPException, IOException, InterruptedException [protected] |
Tries to establish a connection to peer and waits for peer to connect. See handleResponse().
Reimplemented from de.fu_berlin.inf.dpp.net.internal.ByteStreamTransport.
BytestreamSession de.fu_berlin.inf.dpp.net.internal.Socks5Transport.establishResponseSession | ( | String | sessionID, |
String | peer | ||
) | throws XMPPException, IOException, InterruptedException [protected] |
peer |
XMPPException | |
IOException | |
InterruptedException |
Future<Socks5BytestreamSession> de.fu_berlin.inf.dpp.net.internal.Socks5Transport.futureToEstablishResponseSession | ( | final String | sessionID, |
final String | peer | ||
) | [protected] |
sessionID | |
peer |
ConnectionMode de.fu_berlin.inf.dpp.net.internal.Socks5Transport.getNetTransferMode | ( | ) | [virtual] |
void de.fu_berlin.inf.dpp.net.internal.Socks5Transport.handleResponse | ( | BytestreamRequest | request | ) | throws XMPPException, InterruptedException [protected] |
Handles a response request.
The session is exchanged to the connecting thread.
request |
XMPPException | |
InterruptedException |
void de.fu_berlin.inf.dpp.net.internal.Socks5Transport.initialize | ( | Connection | connection, |
IByteStreamConnectionListener | listener | ||
) |
Initializes the transport. After initialization the transport is able to establish connections via connect.
connection | |
listener |
Reimplemented from de.fu_berlin.inf.dpp.net.internal.ByteStreamTransport.
boolean de.fu_berlin.inf.dpp.net.internal.Socks5Transport.streamIsBidirectional | ( | Socks5BytestreamSession | session, |
boolean | sendFirst | ||
) | throws IOException [protected] |
Sends and receives an INT to distinguish between bidirectional and unidirectional streams.
session | |
sendFirst |
IOException |
BytestreamSession de.fu_berlin.inf.dpp.net.internal.Socks5Transport.testAndGetMediatedBidirectionalBytestream | ( | Socks5BytestreamSession | inSession, |
Socks5BytestreamSession | outSession, | ||
boolean | preferInSession | ||
) | throws IOException [protected] |
Tests one of the bytestreams != null in the opposite direction. It returns it if bidirectional or tries to wrap two unidirectional streams if possible. Else an exception is thrown. The testing order is defined by the boolean preferInSession.
inSession | |
outSession | |
preferInSession | which stream to test preferable (if != null) |
IOException | if there is only one unidirectional session |
String de.fu_berlin.inf.dpp.net.internal.Socks5Transport.toString | ( | ) |
void de.fu_berlin.inf.dpp.net.internal.Socks5Transport.uninitialize | ( | ) |
Un-initializes the transport. After un-initialization the transport is not able to establish connections via connect.
Reimplemented from de.fu_berlin.inf.dpp.net.internal.ByteStreamTransport.
String de.fu_berlin.inf.dpp.net.internal.Socks5Transport.verboseLocalProxyInfo | ( | ) | [protected] |
void de.fu_berlin.inf.dpp.net.internal.Socks5Transport.waitToCloseResponse | ( | final Future< Socks5BytestreamSession > | future | ) | [protected] |
Starts a new thread that waits until the connection is established to close it correctly.
future |