blob: fcfbb07701187d68a4c76e89d8b7381e44a4dcb0 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Thomas Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Thomas Vachuska781d18b2014-10-27 10:31:25 -070015 */
tomf110fff2014-09-26 00:38:18 -070016package org.onlab.onos.foo;
17
18import org.onlab.nio.AbstractMessage;
19
tom0e0863f2014-09-26 09:02:33 -070020import static com.google.common.base.Preconditions.checkNotNull;
21
tomf110fff2014-09-26 00:38:18 -070022/**
tom0e0863f2014-09-26 09:02:33 -070023 * Test message for measuring rate and round-trip latency.
tomf110fff2014-09-26 00:38:18 -070024 */
25public class TestMessage extends AbstractMessage {
26
tom0e0863f2014-09-26 09:02:33 -070027 private final byte[] padding;
tomf110fff2014-09-26 00:38:18 -070028
tom0e0863f2014-09-26 09:02:33 -070029 private final long requestorTime;
30 private final long responderTime;
tomf110fff2014-09-26 00:38:18 -070031
32 /**
33 * Creates a new message with the specified data.
34 *
Thomas Vachuskab14c77a2014-11-04 18:08:01 -080035 * @param length message length
tom0e0863f2014-09-26 09:02:33 -070036 * @param requestorTime requester time
37 * @param responderTime responder time
38 * @param padding message padding
tomf110fff2014-09-26 00:38:18 -070039 */
tom0e0863f2014-09-26 09:02:33 -070040 TestMessage(int length, long requestorTime, long responderTime, byte[] padding) {
41 this.length = length;
42 this.requestorTime = requestorTime;
43 this.responderTime = responderTime;
44 this.padding = checkNotNull(padding, "Padding cannot be null");
tomf110fff2014-09-26 00:38:18 -070045 }
46
tom0e0863f2014-09-26 09:02:33 -070047 public long requestorTime() {
48 return requestorTime;
49 }
50
51 public long responderTime() {
52 return responderTime;
53 }
54
55 public byte[] padding() {
56 return padding;
tomf110fff2014-09-26 00:38:18 -070057 }
58
59}