public abstract class BaseRelayClient extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Set<RelayListener> |
listeners |
| Constructor and Description |
|---|
BaseRelayClient(PeerAddress relayAddress) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCloseListener(RelayListener listener)
Adds a close listener for an open peer connection, so that if the
connection to the relay peer drops, a new relay is found and a new relay
connection is established
|
protected void |
notifyCloseListeners()
Call this to notify all listeners attached by
addCloseListener(RelayListener) |
abstract void |
onMapUpdateFailed()
Is called when the
PeerMapUpdateTask failed to send the new map. |
abstract void |
onMapUpdateSuccess()
Is called when the
PeerMapUpdateTask successfully sent the map
to the relay peer. |
PeerAddress |
relayAddress() |
abstract FutureResponse |
sendToRelay(Message message) |
abstract FutureDone<Void> |
shutdown() |
protected final Set<RelayListener> listeners
public BaseRelayClient(PeerAddress relayAddress)
public PeerAddress relayAddress()
public abstract FutureResponse sendToRelay(Message message)
public abstract FutureDone<Void> shutdown()
public abstract void onMapUpdateSuccess()
PeerMapUpdateTask successfully sent the map
to the relay peer.public abstract void onMapUpdateFailed()
PeerMapUpdateTask failed to send the new map.
This can act as an indicator that the relay peer is now offline.public final void addCloseListener(RelayListener listener)
peerConnection - the peer connection on which to add a close listenerbootstrapBuilder - bootstrap builder, used to find neighbors of this peerprotected final void notifyCloseListeners()
addCloseListener(RelayListener)Copyright © 2015. All rights reserved.