Package com.biglybt.pif.network
Interface Connection
-
- All Known Implementing Classes:
ConnectionImpl
,ExternalSeedPeer.ESConnection
public interface Connection
Represents a managed peer connection, over which messages can be sent and received.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close and shutdown this connection.void
connect(ConnectionListener listener)
Connect this connection's transport, i.e.IncomingMessageQueue
getIncomingMessageQueue()
Get the connection's incoming message queue.OutgoingMessageQueue
getOutgoingMessageQueue()
Get the connection's outgoing message queue.java.lang.String
getString()
descriptive text for the connectionTransport
getTransport()
Returns the transport object for this connection.boolean
isIncoming()
Returns true if the connection represents an incoming connection.void
startMessageProcessing()
Begin processing incoming and outgoing message queues.
-
-
-
Method Detail
-
connect
void connect(ConnectionListener listener)
Connect this connection's transport, i.e. establish the peer connection. If this connection is already established (from an incoming connection for example), then this provides a mechanism to register the connection listener, in which case connectSuccess() will be called immediately.- Parameters:
listener
- notified on connect success or failure
-
close
void close()
Close and shutdown this connection.
-
getOutgoingMessageQueue
OutgoingMessageQueue getOutgoingMessageQueue()
Get the connection's outgoing message queue.- Returns:
- outbound message queue
-
getIncomingMessageQueue
IncomingMessageQueue getIncomingMessageQueue()
Get the connection's incoming message queue.- Returns:
- inbound message queue
-
startMessageProcessing
void startMessageProcessing()
Begin processing incoming and outgoing message queues.
-
getTransport
Transport getTransport()
Returns the transport object for this connection.- Since:
- 3.0.5.3
-
isIncoming
boolean isIncoming()
Returns true if the connection represents an incoming connection.- Since:
- 3.0.5.3
-
getString
java.lang.String getString()
descriptive text for the connection- Returns:
-
-