Working on IO loop tests.
diff --git a/utils/nio/src/test/java/org/onlab/nio/IOLoopTestServer.java b/utils/nio/src/test/java/org/onlab/nio/IOLoopTestServer.java
index 3bcbaa1..18566d7 100644
--- a/utils/nio/src/test/java/org/onlab/nio/IOLoopTestServer.java
+++ b/utils/nio/src/test/java/org/onlab/nio/IOLoopTestServer.java
@@ -1,5 +1,6 @@
package org.onlab.nio;
+import com.google.common.collect.Lists;
import org.onlab.util.Counter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -19,8 +20,9 @@
import java.util.concurrent.Executors;
import static java.lang.String.format;
+import static java.lang.System.currentTimeMillis;
import static java.lang.System.out;
-import static org.onlab.junit.TestTools.delay;
+import static org.onlab.util.Tools.delay;
import static org.onlab.util.Tools.namedThreads;
/**
@@ -58,7 +60,7 @@
* Main entry point to launch the server.
*
* @param args command-line arguments
- * @throws IOException if unable to crate IO loops
+ * @throws java.io.IOException if unable to crate IO loops
*/
public static void main(String[] args) throws IOException {
startStandalone(args);
@@ -94,7 +96,7 @@
* @param wc worker count
* @param ml message length in bytes
* @param port listen port
- * @throws IOException if unable to create IO loops
+ * @throws java.io.IOException if unable to create IO loops
*/
public IOLoopTestServer(InetAddress ip, int wc, int ml, int port) throws IOException {
this.workerCount = wc;
@@ -199,11 +201,20 @@
protected void processMessages(List<TestMessage> messages,
MessageStream<TestMessage> stream) {
try {
- stream.write(messages);
+ stream.write(createResponses(messages));
} catch (IOException e) {
log.error("Unable to echo messages", e);
}
}
+
+ private List<TestMessage> createResponses(List<TestMessage> messages) {
+ List<TestMessage> responses = Lists.newArrayListWithCapacity(messages.size());
+ for (TestMessage message : messages) {
+ responses.add(new TestMessage(message.length(), message.requestorTime(),
+ currentTimeMillis(), message.padding()));
+ }
+ return responses;
+ }
}
// Loop for accepting client connections