blob: 1ce469af8ace10a9256f6739aaeda5ef876c11bd [file] [log] [blame]
toma7083182014-09-25 21:38:03 -07001package org.onlab.nio;
2
tom1ae3d162014-09-26 09:38:16 -07003import static com.google.common.base.Preconditions.checkNotNull;
4
toma7083182014-09-25 21:38:03 -07005/**
tom1ae3d162014-09-26 09:38:16 -07006 * Test message for measuring rate and round-trip latency.
toma7083182014-09-25 21:38:03 -07007 */
8public class TestMessage extends AbstractMessage {
9
tom1ae3d162014-09-26 09:38:16 -070010 private final byte[] padding;
toma7083182014-09-25 21:38:03 -070011
tom1ae3d162014-09-26 09:38:16 -070012 private final long requestorTime;
13 private final long responderTime;
toma7083182014-09-25 21:38:03 -070014
15 /**
16 * Creates a new message with the specified data.
17 *
tom1ae3d162014-09-26 09:38:16 -070018 * @param requestorTime requester time
19 * @param responderTime responder time
20 * @param padding message padding
toma7083182014-09-25 21:38:03 -070021 */
tom1ae3d162014-09-26 09:38:16 -070022 TestMessage(int length, long requestorTime, long responderTime, byte[] padding) {
23 this.length = length;
24 this.requestorTime = requestorTime;
25 this.responderTime = responderTime;
26 this.padding = checkNotNull(padding, "Padding cannot be null");
toma7083182014-09-25 21:38:03 -070027 }
28
tom1ae3d162014-09-26 09:38:16 -070029 public long requestorTime() {
30 return requestorTime;
31 }
32
33 public long responderTime() {
34 return responderTime;
35 }
36
37 public byte[] padding() {
38 return padding;
toma7083182014-09-25 21:38:03 -070039 }
40
41}