public class MessageProtocolHandler
extends java.lang.Object
| Constructor and Description |
|---|
MessageProtocolHandler(java.lang.String peerName,
Connection connection) |
| Modifier and Type | Method and Description |
|---|---|
<T extends Message> |
maybeReceive(java.lang.Class<T> type,
java.time.Duration timeout)
Waits for the message for duration of timeout or returns Optional.empty() if waiting timeouts.
|
<T extends Message> |
receive(java.lang.Class<T> type,
java.time.Duration timeout)
Waits for the message for duration of timeout and throws exception if waiting timeouts.
|
void |
send(Message message) |
public MessageProtocolHandler(java.lang.String peerName,
Connection connection)
public void send(Message message)
public <T extends Message> java.util.Optional<T> maybeReceive(java.lang.Class<T> type, java.time.Duration timeout)
public <T extends Message> T receive(java.lang.Class<T> type, java.time.Duration timeout)