blob: bfc599457cb31a1c8ee124fe5e6e8adc0995724e [file] [log] [blame]
Thomas Vachuska24c849c2014-10-27 09:53:05 -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 */
toma7083182014-09-25 21:38:03 -070019package org.onlab.nio;
20
tom1ae3d162014-09-26 09:38:16 -070021import static com.google.common.base.Preconditions.checkNotNull;
22
toma7083182014-09-25 21:38:03 -070023/**
tom1ae3d162014-09-26 09:38:16 -070024 * Test message for measuring rate and round-trip latency.
toma7083182014-09-25 21:38:03 -070025 */
26public class TestMessage extends AbstractMessage {
27
tom1ae3d162014-09-26 09:38:16 -070028 private final byte[] padding;
toma7083182014-09-25 21:38:03 -070029
tom1ae3d162014-09-26 09:38:16 -070030 private final long requestorTime;
31 private final long responderTime;
toma7083182014-09-25 21:38:03 -070032
33 /**
34 * Creates a new message with the specified data.
35 *
tom1ae3d162014-09-26 09:38:16 -070036 * @param requestorTime requester time
37 * @param responderTime responder time
38 * @param padding message padding
toma7083182014-09-25 21:38:03 -070039 */
tom1ae3d162014-09-26 09:38:16 -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");
toma7083182014-09-25 21:38:03 -070045 }
46
tom1ae3d162014-09-26 09:38:16 -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;
toma7083182014-09-25 21:38:03 -070057 }
58
59}