TestMessage.java
1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package org.onlab.nio;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Test message for measuring rate and round-trip latency.
*/
public class TestMessage extends AbstractMessage {
private final byte[] padding;
private final long requestorTime;
private final long responderTime;
/**
* Creates a new message with the specified data.
*
* @param requestorTime requester time
* @param responderTime responder time
* @param padding message padding
*/
TestMessage(int length, long requestorTime, long responderTime, byte[] padding) {
this.length = length;
this.requestorTime = requestorTime;
this.responderTime = responderTime;
this.padding = checkNotNull(padding, "Padding cannot be null");
}
public long requestorTime() {
return requestorTime;
}
public long responderTime() {
return responderTime;
}
public byte[] padding() {
return padding;
}
}