blob: 5e36ce091a46ec7408de567f8b013ee9ff71cbcd [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
tomf110fff2014-09-26 00:38:18 -070019package org.onlab.onos.foo;
20
21import org.onlab.nio.AbstractMessage;
22
tom0e0863f2014-09-26 09:02:33 -070023import static com.google.common.base.Preconditions.checkNotNull;
24
tomf110fff2014-09-26 00:38:18 -070025/**
tom0e0863f2014-09-26 09:02:33 -070026 * Test message for measuring rate and round-trip latency.
tomf110fff2014-09-26 00:38:18 -070027 */
28public class TestMessage extends AbstractMessage {
29
tom0e0863f2014-09-26 09:02:33 -070030 private final byte[] padding;
tomf110fff2014-09-26 00:38:18 -070031
tom0e0863f2014-09-26 09:02:33 -070032 private final long requestorTime;
33 private final long responderTime;
tomf110fff2014-09-26 00:38:18 -070034
35 /**
36 * Creates a new message with the specified data.
37 *
tom0e0863f2014-09-26 09:02:33 -070038 * @param requestorTime requester time
39 * @param responderTime responder time
40 * @param padding message padding
tomf110fff2014-09-26 00:38:18 -070041 */
tom0e0863f2014-09-26 09:02:33 -070042 TestMessage(int length, long requestorTime, long responderTime, byte[] padding) {
43 this.length = length;
44 this.requestorTime = requestorTime;
45 this.responderTime = responderTime;
46 this.padding = checkNotNull(padding, "Padding cannot be null");
tomf110fff2014-09-26 00:38:18 -070047 }
48
tom0e0863f2014-09-26 09:02:33 -070049 public long requestorTime() {
50 return requestorTime;
51 }
52
53 public long responderTime() {
54 return responderTime;
55 }
56
57 public byte[] padding() {
58 return padding;
tomf110fff2014-09-26 00:38:18 -070059 }
60
61}