tom | a708318 | 2014-09-25 21:38:03 -0700 | [diff] [blame] | 1 | package org.onlab.nio; |
| 2 | |
tom | 1ae3d16 | 2014-09-26 09:38:16 -0700 | [diff] [blame] | 3 | import static com.google.common.base.Preconditions.checkNotNull; |
| 4 | |
tom | a708318 | 2014-09-25 21:38:03 -0700 | [diff] [blame] | 5 | /** |
tom | 1ae3d16 | 2014-09-26 09:38:16 -0700 | [diff] [blame] | 6 | * Test message for measuring rate and round-trip latency. |
tom | a708318 | 2014-09-25 21:38:03 -0700 | [diff] [blame] | 7 | */ |
| 8 | public class TestMessage extends AbstractMessage { |
| 9 | |
tom | 1ae3d16 | 2014-09-26 09:38:16 -0700 | [diff] [blame] | 10 | private final byte[] padding; |
tom | a708318 | 2014-09-25 21:38:03 -0700 | [diff] [blame] | 11 | |
tom | 1ae3d16 | 2014-09-26 09:38:16 -0700 | [diff] [blame] | 12 | private final long requestorTime; |
| 13 | private final long responderTime; |
tom | a708318 | 2014-09-25 21:38:03 -0700 | [diff] [blame] | 14 | |
| 15 | /** |
| 16 | * Creates a new message with the specified data. |
| 17 | * |
tom | 1ae3d16 | 2014-09-26 09:38:16 -0700 | [diff] [blame] | 18 | * @param requestorTime requester time |
| 19 | * @param responderTime responder time |
| 20 | * @param padding message padding |
tom | a708318 | 2014-09-25 21:38:03 -0700 | [diff] [blame] | 21 | */ |
tom | 1ae3d16 | 2014-09-26 09:38:16 -0700 | [diff] [blame] | 22 | 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"); |
tom | a708318 | 2014-09-25 21:38:03 -0700 | [diff] [blame] | 27 | } |
| 28 | |
tom | 1ae3d16 | 2014-09-26 09:38:16 -0700 | [diff] [blame] | 29 | public long requestorTime() { |
| 30 | return requestorTime; |
| 31 | } |
| 32 | |
| 33 | public long responderTime() { |
| 34 | return responderTime; |
| 35 | } |
| 36 | |
| 37 | public byte[] padding() { |
| 38 | return padding; |
tom | a708318 | 2014-09-25 21:38:03 -0700 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | } |