You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2013/03/20 16:41:26 UTC

[2/2] git commit: o Added a .gitgnore in the benchmarks module o Bumped up to Netty 3.6.3 o Added netty UDP benchmarks o Created sub-package (nio and tcp) for the various benchmarks o Started to refactor the IoSessionConfig implementing classes to take c

o Added a .gitgnore in the benchmarks module
o Bumped up to Netty 3.6.3
o Added netty UDP benchmarks
o Created sub-package (nio and tcp) for the various benchmarks
o Started to refactor the IoSessionConfig implementing classes to take care of UDP
o Started to mplement the UDP client and server


Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/626868af
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/626868af
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/626868af

Branch: refs/heads/trunk
Commit: 626868afa2d79cca9573574e130e5297d49a7cdd
Parents: 9b47d0d
Author: Emmanuel Lécharny <el...@apache.org>
Authored: Wed Mar 20 16:36:39 2013 +0100
Committer: Emmanuel Lécharny <el...@apache.org>
Committed: Wed Mar 20 16:36:39 2013 +0100

----------------------------------------------------------------------
 benchmarks/.gitignore                              |   13 +
 benchmarks/pom.xml                                 |    4 +-
 .../apache/mina/core/BenchmarkClientFactory.java   |   14 +-
 .../org/apache/mina/core/BenchmarkFactory.java     |    2 +-
 .../apache/mina/core/BenchmarkServerFactory.java   |   14 +-
 .../org/apache/mina/core/Mina3BenchmarkClient.java |  111 ---------
 .../org/apache/mina/core/Mina3BenchmarkServer.java |  157 ------------
 ...ina3ClientVsMina3ServerBenchmarkBinaryTest.java |   74 ------
 ...3ClientVsMina3ServerTcpBenchmarkBinaryTest.java |   65 +++++
 ...3ClientVsMina3ServerUdpBenchmarkBinaryTest.java |   65 +++++
 ...ClientVsNetty3ServerTcpBenchmarkBinaryTest.java |   65 +++++
 ...MinaClientVsNettyServerBenchmarkBinaryTest.java |   74 ------
 ...3ClientVsMina3ServerTcpBenchmarkBinaryTest.java |   64 +++++
 ...ClientVsNetty3ServerTcpBenchmarkBinaryTest.java |   64 +++++
 .../org/apache/mina/core/NettyBenchmarkClient.java |  102 --------
 .../org/apache/mina/core/NettyBenchmarkServer.java |  187 ---------------
 ...NettyClientVsMinaServerBenchmarkBinaryTest.java |   74 ------
 ...ettyClientVsNettyServerBenchmarkBinaryTest.java |   74 ------
 .../mina/core/nio/tcp/Mina3TcpBenchmarkClient.java |  112 +++++++++
 .../mina/core/nio/tcp/Mina3TcpBenchmarkServer.java |  158 ++++++++++++
 .../core/nio/tcp/Netty3TcpBenchmarkClient.java     |  103 ++++++++
 .../core/nio/tcp/Netty3TcpBenchmarkServer.java     |  187 +++++++++++++++
 .../mina/core/nio/udp/Mina3UdpBenchmarkClient.java |  121 ++++++++++
 .../mina/core/nio/udp/Mina3UdpBenchmarkServer.java |  160 ++++++++++++
 ...ClientVsNetty3ServerUdpBenchmarkBinaryTest.java |   66 +++++
 .../core/nio/udp/Netty3UdpBenchmarkClient.java     |  101 ++++++++
 .../core/nio/udp/Netty3UdpBenchmarkServer.java     |  185 ++++++++++++++
 .../java/org/apache/mina/api/IoSessionConfig.java  |   68 ++++++
 .../mina/session/AbstractIoSessionConfig.java      |   83 ++++++-
 .../org/apache/mina/session/TrafficClassEnum.java  |   70 ++++++
 .../apache/mina/transport/nio/NioTcpClient.java    |    6 +-
 .../apache/mina/transport/nio/NioTcpServer.java    |    6 +-
 .../apache/mina/transport/nio/NioUdpClient.java    |   21 ++-
 .../apache/mina/transport/nio/NioUdpServer.java    |    9 +
 .../transport/tcp/DefaultTcpSessionConfig.java     |   57 -----
 .../mina/transport/tcp/ProxyTcpSessionConfig.java  |   20 ++-
 .../mina/transport/tcp/TcpSessionConfig.java       |   44 ----
 .../mina/transport/udp/AbstractUdpServer.java      |    4 +
 .../transport/udp/DefaultUdpSessionConfig.java     |   65 +++++
 .../mina/transport/udp/UdpSessionConfig.java       |   25 ++-
 .../tcp/ProxySocketSessionConfigTest.java          |   10 +-
 41 files changed, 1920 insertions(+), 984 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/.gitignore
----------------------------------------------------------------------
diff --git a/benchmarks/.gitignore b/benchmarks/.gitignore
new file mode 100644
index 0000000..ca7d13f
--- /dev/null
+++ b/benchmarks/.gitignore
@@ -0,0 +1,13 @@
+.classpath
+.project
+.settings
+.wtpmodules
+*.ipr
+*.iws
+*.iml
+target/
+bin/
+*.log
+.deployables
+.clover
+

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/pom.xml
----------------------------------------------------------------------
diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml
index 41d99dd..615756e 100755
--- a/benchmarks/pom.xml
+++ b/benchmarks/pom.xml
@@ -34,9 +34,9 @@
   <properties>
      <!-- defined in order to run against a different MINA version -->
      <mina.version>${project.version}</mina.version>
-     <netty.version>3.5.9.Final</netty.version>
+     <netty.version>3.6.3.Final</netty.version>
   </properties>
-
+  
   <dependencies>
     <dependency>
       <groupId>${project.groupId}</groupId>

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java
index 023f8c6..059651a 100755
--- a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java
+++ b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java
@@ -19,6 +19,10 @@
  */
 package org.apache.mina.core;
 
+import org.apache.mina.core.nio.tcp.Mina3TcpBenchmarkClient;
+import org.apache.mina.core.nio.tcp.Netty3TcpBenchmarkClient;
+import org.apache.mina.core.nio.udp.Mina3UdpBenchmarkClient;
+
 /**
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
@@ -28,10 +32,12 @@ public class BenchmarkClientFactory implements BenchmarkFactory<BenchmarkClient>
 
     public BenchmarkClient get(Type type) {
         switch (type) {
-        case Mina:
-            return new Mina3BenchmarkClient();
-        case Netty:
-            return new NettyBenchmarkClient();
+        case Mina3_tcp:
+            return new Mina3TcpBenchmarkClient();
+        case Mina3_udp:
+            return new Mina3UdpBenchmarkClient();
+        case Netty3_tcp:
+            return new Netty3TcpBenchmarkClient();
         default:
             throw new IllegalArgumentException("Invalid type " + type);
         }

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/BenchmarkFactory.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkFactory.java b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkFactory.java
index d852cb8..d99fd54 100755
--- a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkFactory.java
+++ b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkFactory.java
@@ -29,7 +29,7 @@ public interface BenchmarkFactory<T> {
      * The different types of providers
      */
     public enum Type {
-        Mina, Netty
+        Mina3_tcp, Mina3_udp, Netty3_tcp, Netty3_udp, Netty4_tcp, Netty4_udp
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java
index 623ba52..6377063 100755
--- a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java
+++ b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java
@@ -19,6 +19,10 @@
  */
 package org.apache.mina.core;
 
+import org.apache.mina.core.nio.tcp.Mina3TcpBenchmarkServer;
+import org.apache.mina.core.nio.tcp.Netty3TcpBenchmarkServer;
+import org.apache.mina.core.nio.udp.Mina3UdpBenchmarkServer;
+
 /**
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
@@ -31,10 +35,12 @@ public class BenchmarkServerFactory implements BenchmarkFactory<BenchmarkServer>
      */
     public BenchmarkServer get(org.apache.mina.core.BenchmarkFactory.Type type) {
         switch (type) {
-        case Mina:
-            return new Mina3BenchmarkServer();
-        case Netty:
-            return new NettyBenchmarkServer();
+        case Mina3_tcp:
+            return new Mina3TcpBenchmarkServer();
+        case Mina3_udp:
+            return new Mina3UdpBenchmarkServer();
+        case Netty3_tcp:
+            return new Netty3TcpBenchmarkServer();
         default:
             throw new IllegalArgumentException("Invalid type " + type);
         }

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/Mina3BenchmarkClient.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Mina3BenchmarkClient.java b/benchmarks/src/test/java/org/apache/mina/core/Mina3BenchmarkClient.java
deleted file mode 100755
index 23681ad..0000000
--- a/benchmarks/src/test/java/org/apache/mina/core/Mina3BenchmarkClient.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.core;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.nio.ByteBuffer;
-import java.util.concurrent.CountDownLatch;
-
-import org.apache.mina.api.IdleStatus;
-import org.apache.mina.api.IoHandler;
-import org.apache.mina.api.IoService;
-import org.apache.mina.api.IoSession;
-import org.apache.mina.transport.nio.NioTcpClient;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class Mina3BenchmarkClient implements BenchmarkClient {
-    // The TCP client
-    private NioTcpClient client;
-
-    /**
-     * {@inheritDoc}
-     */
-    public void start(int port, final CountDownLatch counter, final byte[] data) throws IOException {
-        client = new NioTcpClient();
-        client.getSessionConfig().setSendBufferSize(64 * 1024);
-        client.getSessionConfig().setTcpNoDelay(true);
-        client.setIoHandler(new IoHandler() {
-            private void sendMessage(IoSession session, byte[] data) {
-                ByteBuffer iobuf = ByteBuffer.wrap(data);
-                session.write(iobuf);
-            }
-
-            public void sessionOpened(IoSession session) {
-                //System.out.println("Client session opened");
-                sendMessage(session, data);
-            }
-
-            public void messageReceived(IoSession session, Object message) {
-                //System.out.println("Client message received : " + message);
-                if (message instanceof ByteBuffer) {
-                    ByteBuffer buffer = (ByteBuffer) message;
-                    //System.out.println("length=" + buffer.remaining());
-                    for (int i = 0; i < buffer.remaining(); ++i) {
-                        counter.countDown();
-                        long count = counter.getCount();
-                        if (count > 0) {
-                            sendMessage(session, data);
-                            if (count % 100000 == 0) {
-                                System.out.println("Received " + count);
-                            }
-                        }
-                    }
-                }
-            }
-
-            public void exceptionCaught(IoSession session, Throwable cause) {
-                cause.printStackTrace();
-            }
-
-            @Override
-            public void sessionClosed(IoSession session) {
-            }
-
-            @Override
-            public void sessionIdle(IoSession session, IdleStatus status) {
-            }
-
-            @Override
-            public void messageSent(IoSession session, Object message) {
-                //System.out.println("Client message sent : " + message);
-            }
-
-            @Override
-            public void serviceActivated(IoService service) {
-            }
-
-            @Override
-            public void serviceInactivated(IoService service) {
-            }
-        });
-
-        client.connect(new InetSocketAddress(port));
-    }
-
-    /**
-     * {@inheritedDoc}
-     */
-    public void stop() throws IOException {
-        client.disconnect();
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/Mina3BenchmarkServer.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Mina3BenchmarkServer.java b/benchmarks/src/test/java/org/apache/mina/core/Mina3BenchmarkServer.java
deleted file mode 100755
index 80c1b11..0000000
--- a/benchmarks/src/test/java/org/apache/mina/core/Mina3BenchmarkServer.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.core;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.nio.ByteBuffer;
-
-import org.apache.mina.api.IdleStatus;
-import org.apache.mina.api.IoHandler;
-import org.apache.mina.api.IoService;
-import org.apache.mina.api.IoSession;
-import org.apache.mina.session.AttributeKey;
-import org.apache.mina.transport.nio.NioTcpServer;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class Mina3BenchmarkServer implements BenchmarkServer {
-
-    private static enum State {
-        WAIT_FOR_FIRST_BYTE_LENGTH, WAIT_FOR_SECOND_BYTE_LENGTH, WAIT_FOR_THIRD_BYTE_LENGTH, WAIT_FOR_FOURTH_BYTE_LENGTH, READING
-    }
-
-    private static final ByteBuffer ACK = ByteBuffer.allocate(1);
-
-    static {
-        ACK.put((byte) 0);
-        ACK.rewind();
-    }
-
-    private static final AttributeKey<State> STATE_ATTRIBUTE = new AttributeKey<State>(State.class,
-            Mina3BenchmarkServer.class.getName() + ".state");
-
-    private static final AttributeKey<Integer> LENGTH_ATTRIBUTE = new AttributeKey<Integer>(Integer.class,
-            Mina3BenchmarkServer.class.getName() + ".length");
-
-    private NioTcpServer tcpServer;
-
-    /**
-     * {@inheritDoc}
-     */
-    public void start(int port) throws IOException {
-        tcpServer = new NioTcpServer();
-        tcpServer.getSessionConfig().setReceiveBufferSize(128 * 1024);
-        tcpServer.getSessionConfig().setTcpNoDelay(true);
-        tcpServer.setIoHandler(new IoHandler() {
-            public void sessionOpened(IoSession session) {
-                //System.out.println("Server session opened");
-                session.setAttribute(STATE_ATTRIBUTE, State.WAIT_FOR_FIRST_BYTE_LENGTH);
-            }
-
-            public void messageReceived(IoSession session, Object message) {
-                //System.out.println("Server Message received : " + message);
-                if (message instanceof ByteBuffer) {
-                    ByteBuffer buffer = (ByteBuffer) message;
-
-                    State state = session.getAttribute(STATE_ATTRIBUTE);
-                    int length = 0;
-
-                    if (session.getAttribute(LENGTH_ATTRIBUTE) != null) {
-                        length = session.getAttribute(LENGTH_ATTRIBUTE);
-                    }
-
-                    while (buffer.remaining() > 0) {
-                        switch (state) {
-                        case WAIT_FOR_FIRST_BYTE_LENGTH:
-                            length = (buffer.get() & 255) << 24;
-                            state = State.WAIT_FOR_SECOND_BYTE_LENGTH;
-                            break;
-                        case WAIT_FOR_SECOND_BYTE_LENGTH:
-                            length += (buffer.get() & 255) << 16;
-                            state = State.WAIT_FOR_THIRD_BYTE_LENGTH;
-                            break;
-                        case WAIT_FOR_THIRD_BYTE_LENGTH:
-                            length += (buffer.get() & 255) << 8;
-                            state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
-                            break;
-                        case WAIT_FOR_FOURTH_BYTE_LENGTH:
-                            length += (buffer.get() & 255);
-                            state = State.READING;
-                            if ((length == 0) && (buffer.remaining() == 0)) {
-                                session.write(ACK.slice());
-                                state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
-                            }
-                            break;
-                        case READING:
-                            int remaining = buffer.remaining();
-                            if (length > remaining) {
-                                length -= remaining;
-                                buffer.position(buffer.position() + remaining);
-                            } else {
-                                buffer.position(buffer.position() + length);
-                                session.write(ACK.slice());
-                                state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
-                                length = 0;
-                            }
-                        }
-                    }
-                    session.setAttribute(LENGTH_ATTRIBUTE, length);
-                    session.setAttribute(STATE_ATTRIBUTE, state);
-                }
-            }
-
-            public void exceptionCaught(IoSession session, Throwable cause) {
-                cause.printStackTrace();
-            }
-
-            @Override
-            public void sessionClosed(IoSession session) {
-            }
-
-            @Override
-            public void sessionIdle(IoSession session, IdleStatus status) {
-            }
-
-            @Override
-            public void messageSent(IoSession session, Object message) {
-                //System.out.println("Server message sent :" + message);
-            }
-
-            @Override
-            public void serviceActivated(IoService service) {
-            }
-
-            @Override
-            public void serviceInactivated(IoService service) {
-            }
-        });
-
-        tcpServer.bind(new InetSocketAddress(port));
-    }
-
-    /**
-     * {@inheritedDoc}
-     */
-    public void stop() throws IOException {
-        tcpServer.unbind();
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerBenchmarkBinaryTest.java
deleted file mode 100755
index 19eba35..0000000
--- a/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerBenchmarkBinaryTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.core;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.mina.core.BenchmarkFactory.Type;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class Mina3ClientVsMina3ServerBenchmarkBinaryTest extends BenchmarkBinaryTest {
-
-    /**
-     * @param numberOfMessages
-     * @param messageSize
-     */
-    public Mina3ClientVsMina3ServerBenchmarkBinaryTest(int numberOfMessages, int messageSize, int timeout) {
-        super(numberOfMessages, messageSize, timeout);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getClientType() {
-        return Type.Mina;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getServerType() {
-        return Type.Mina;
-    }
-
-    @Parameters(name="{0} messages of size {1}")
-    public static Collection<Object[]> getParameters() {
-        Object[][] parameters = new Object[][] {
-                { 1000000, 10, 2 * 60 }, 
-                { 1000000, 1 * 1024, 2 * 60 },
-                { 1000000, 10 * 1024, 2 * 60 }, 
-                { 1000000, 20 * 1024, 2 * 60 }, 
-                {  500000, 50 * 1024, 2 * 60 }, 
-                {  200000, 100 * 1024, 2 * 60 }, 
-                {  100000, 200 * 1024, 2 * 60 }, 
-                {   50000, 500 * 1024, 2 * 60 }, 
-                {   20000, 1024 * 1024, 2 * 60 }, 
-                {    2000, 10 * 1024* 1024, 2 * 60 }, 
-                {    500, 64 * 1024 * 1024, 2 * 60 } 
-                };
-        return Arrays.asList(parameters);
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerTcpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerTcpBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerTcpBenchmarkBinaryTest.java
new file mode 100755
index 0000000..d258ec8
--- /dev/null
+++ b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerTcpBenchmarkBinaryTest.java
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.mina.core.BenchmarkFactory.Type;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Mina3ClientVsMina3ServerTcpBenchmarkBinaryTest extends BenchmarkBinaryTest {
+
+    /**
+     * @param numberOfMessages
+     * @param messageSize
+     */
+    public Mina3ClientVsMina3ServerTcpBenchmarkBinaryTest(int numberOfMessages, int messageSize, int timeout) {
+        super(numberOfMessages, messageSize, timeout);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Type getClientType() {
+        return Type.Mina3_tcp;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Type getServerType() {
+        return Type.Mina3_tcp;
+    }
+
+    @Parameters(name = "{0} messages of size {1}")
+    public static Collection<Object[]> getParameters() {
+        Object[][] parameters = new Object[][] { { 1000000, 10, 2 * 60 }, { 1000000, 1 * 1024, 2 * 60 },
+                { 1000000, 10 * 1024, 2 * 60 }, { 1000000, 20 * 1024, 2 * 60 }, { 500000, 50 * 1024, 2 * 60 },
+                { 200000, 100 * 1024, 2 * 60 }, { 100000, 200 * 1024, 2 * 60 }, { 50000, 500 * 1024, 2 * 60 },
+                { 20000, 1024 * 1024, 2 * 60 }, { 2000, 10 * 1024 * 1024, 2 * 60 }, { 500, 64 * 1024 * 1024, 2 * 60 } };
+        return Arrays.asList(parameters);
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
new file mode 100644
index 0000000..6d85a55
--- /dev/null
+++ b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.mina.core.BenchmarkFactory.Type;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest extends BenchmarkBinaryTest {
+
+    /**
+     * @param numberOfMessages
+     * @param messageSize
+     */
+    public Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest(int numberOfMessages, int messageSize, int timeout) {
+        super(numberOfMessages, messageSize, timeout);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Type getClientType() {
+        return Type.Mina3_udp;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Type getServerType() {
+        return Type.Mina3_udp;
+    }
+
+    @Parameters(name = "{0} messages of size {1}")
+    public static Collection<Object[]> getParameters() {
+        Object[][] parameters = new Object[][] { { 1000000, 10, 2 * 60 }, { 1000000, 1 * 1024, 2 * 60 },
+                { 1000000, 10 * 1024, 2 * 60 }, { 1000000, 20 * 1024, 2 * 60 }, { 500000, 50 * 1024, 2 * 60 },
+                { 200000, 100 * 1024, 2 * 60 }, { 100000, 200 * 1024, 2 * 60 }, { 50000, 500 * 1024, 2 * 60 },
+                { 20000, 1024 * 1024, 2 * 60 }, { 2000, 10 * 1024 * 1024, 2 * 60 }, { 500, 64 * 1024 * 1024, 2 * 60 } };
+        return Arrays.asList(parameters);
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsNetty3ServerTcpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsNetty3ServerTcpBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsNetty3ServerTcpBenchmarkBinaryTest.java
new file mode 100644
index 0000000..7ce1769
--- /dev/null
+++ b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsNetty3ServerTcpBenchmarkBinaryTest.java
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.mina.core.BenchmarkFactory.Type;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Mina3ClientVsNetty3ServerTcpBenchmarkBinaryTest extends BenchmarkBinaryTest {
+
+    /**
+     * @param numberOfMessages
+     * @param messageSize
+     */
+    public Mina3ClientVsNetty3ServerTcpBenchmarkBinaryTest(int numberOfMessages, int messageSize, int timeout) {
+        super(numberOfMessages, messageSize, timeout);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Type getClientType() {
+        return Type.Mina3_tcp;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Type getServerType() {
+        return Type.Netty3_tcp;
+    }
+
+    @Parameters()
+    public static Collection<Object[]> getParameters() {
+        Object[][] parameters = new Object[][] { { 1000000, 10, 2 * 60 }, { 1000000, 1 * 1024, 2 * 60 },
+                { 1000000, 10 * 1024, 2 * 60 }, { 1000000, 20 * 1024, 2 * 60 }, { 500000, 50 * 1024, 2 * 60 },
+                { 200000, 100 * 1024, 2 * 60 }, { 100000, 200 * 1024, 2 * 60 }, { 50000, 500 * 1024, 2 * 60 },
+                { 20000, 1024 * 1024, 2 * 60 }, { 2000, 10 * 1024 * 1024, 2 * 60 }, { 500, 64 * 1024 * 1024, 2 * 60 } };
+        return Arrays.asList(parameters);
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/MinaClientVsNettyServerBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/MinaClientVsNettyServerBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/MinaClientVsNettyServerBenchmarkBinaryTest.java
deleted file mode 100644
index 2df932e..0000000
--- a/benchmarks/src/test/java/org/apache/mina/core/MinaClientVsNettyServerBenchmarkBinaryTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.core;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.mina.core.BenchmarkFactory.Type;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class MinaClientVsNettyServerBenchmarkBinaryTest extends BenchmarkBinaryTest {
-
-    /**
-     * @param numberOfMessages
-     * @param messageSize
-     */
-    public MinaClientVsNettyServerBenchmarkBinaryTest(int numberOfMessages, int messageSize, int timeout) {
-        super(numberOfMessages, messageSize, timeout);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getClientType() {
-        return Type.Mina;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getServerType() {
-        return Type.Netty;
-    }
-
-    @Parameters()
-    public static Collection<Object[]> getParameters() {
-        Object[][] parameters = new Object[][] { 
-                { 1000000, 10, 2 * 60 }, 
-                { 1000000, 1 * 1024, 2 * 60 },
-                { 1000000, 10 * 1024, 2 * 60 }, 
-                { 1000000, 20 * 1024, 2 * 60 }, 
-                {  500000, 50 * 1024, 2 * 60 }, 
-                {  200000, 100 * 1024, 2 * 60 }, 
-                {  100000, 200 * 1024, 2 * 60 }, 
-                {   50000, 500 * 1024, 2 * 60 }, 
-                {   20000, 1024 * 1024, 2 * 60 }, 
-                {    2000, 10 * 1024* 1024, 2 * 60 }, 
-                {    500, 64 * 1024 * 1024, 2 * 60 }
-        }; 
-        return Arrays.asList(parameters);
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsMina3ServerTcpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsMina3ServerTcpBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsMina3ServerTcpBenchmarkBinaryTest.java
new file mode 100644
index 0000000..b93b799
--- /dev/null
+++ b/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsMina3ServerTcpBenchmarkBinaryTest.java
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.mina.core.BenchmarkFactory.Type;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Netty3ClientVsMina3ServerTcpBenchmarkBinaryTest extends BenchmarkBinaryTest {
+
+    /**
+     * @param numberOfMessages
+     * @param messageSize
+     */
+    public Netty3ClientVsMina3ServerTcpBenchmarkBinaryTest(int numberOfMessages, int messageSize, int timeout) {
+        super(numberOfMessages, messageSize, timeout);
+    }
+
+    /** {@inheritDoc}
+     */
+    @Override
+    public Type getClientType() {
+        return Type.Netty3_tcp;
+    }
+
+    /** {@inheritDoc}
+     */
+    @Override
+    public Type getServerType() {
+        return Type.Mina3_tcp;
+    }
+
+    //TODO: analyze with Netty is so slow on large message: last test lower to 100 messages
+    @Parameters(name = "{0} messages of size {1}")
+    public static Collection<Object[]> getParameters() {
+        Object[][] parameters = new Object[][] { { 1000000, 10, 2 * 60 }, { 1000000, 1 * 1024, 2 * 60 },
+                { 1000000, 10 * 1024, 2 * 60 }, { 1000000, 20 * 1024, 2 * 60 }, { 500000, 50 * 1024, 2 * 60 },
+                { 200000, 100 * 1024, 2 * 60 }, { 100000, 200 * 1024, 2 * 60 }, { 50000, 500 * 1024, 2 * 60 },
+                { 20000, 1024 * 1024, 2 * 60 }, { 2000, 10 * 1024 * 1024, 2 * 60 }, { 500, 64 * 1024 * 1024, 2 * 60 } };
+        return Arrays.asList(parameters);
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsNetty3ServerTcpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsNetty3ServerTcpBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsNetty3ServerTcpBenchmarkBinaryTest.java
new file mode 100644
index 0000000..0ba293c
--- /dev/null
+++ b/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsNetty3ServerTcpBenchmarkBinaryTest.java
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.mina.core.BenchmarkFactory.Type;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Netty3ClientVsNetty3ServerTcpBenchmarkBinaryTest extends BenchmarkBinaryTest {
+
+    /**
+     * @param numberOfMessages
+     * @param messageSize
+     */
+    public Netty3ClientVsNetty3ServerTcpBenchmarkBinaryTest(int numberOfMessages, int messageSize, int timeout) {
+        super(numberOfMessages, messageSize, timeout);
+    }
+
+    /** {@inheritDoc}
+     */
+    @Override
+    public Type getClientType() {
+        return Type.Netty3_tcp;
+    }
+
+    /** {@inheritDoc}
+     */
+    @Override
+    public Type getServerType() {
+        return Type.Netty3_tcp;
+    }
+
+    //TODO: analyze with Netty is so slow on large message: last test lower to 100 messages
+    @Parameters(name = "{0} messages of size {1}")
+    public static Collection<Object[]> getParameters() {
+        Object[][] parameters = new Object[][] { { 1000000, 10, 2 * 60 }, { 1000000, 1 * 1024, 2 * 60 },
+                { 1000000, 10 * 1024, 2 * 60 }, { 1000000, 20 * 1024, 2 * 60 }, { 500000, 50 * 1024, 2 * 60 },
+                { 200000, 100 * 1024, 2 * 60 }, { 100000, 200 * 1024, 2 * 60 }, { 50000, 500 * 1024, 2 * 60 },
+                { 20000, 1024 * 1024, 2 * 60 }, { 2000, 10 * 1024 * 1024, 2 * 60 }, { 500, 64 * 1024 * 1024, 2 * 60 } };
+        return Arrays.asList(parameters);
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/NettyBenchmarkClient.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/NettyBenchmarkClient.java b/benchmarks/src/test/java/org/apache/mina/core/NettyBenchmarkClient.java
deleted file mode 100644
index 71145dc..0000000
--- a/benchmarks/src/test/java/org/apache/mina/core/NettyBenchmarkClient.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.core;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.concurrent.CountDownLatch;
-
-import org.jboss.netty.bootstrap.ClientBootstrap;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.ChannelFactory;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.channel.ChannelPipelineFactory;
-import org.jboss.netty.channel.ChannelStateEvent;
-import org.jboss.netty.channel.Channels;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
-import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class NettyBenchmarkClient implements BenchmarkClient {
-
-    private ChannelFactory factory;
-
-    /**
-     * 
-     */
-    public NettyBenchmarkClient() {
-    }
-
-    /**
-     * {@inheritedDoc}
-     */
-    public void start(final int port, final CountDownLatch counter, final byte[] data) throws IOException {
-        factory = new NioClientSocketChannelFactory();
-        ClientBootstrap bootstrap = new ClientBootstrap(factory);
-        bootstrap.setOption("sendBufferSize", 64 * 1024);
-        bootstrap.setOption("tcpNoDelay", true);
-        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
-            public ChannelPipeline getPipeline() throws Exception {
-                return Channels.pipeline(new SimpleChannelUpstreamHandler() {
-                    private void sendMessage(ChannelHandlerContext ctx, byte[] data) {
-                        ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(data);
-                        ctx.getChannel().write(buffer);
-                    }
-
-                    @Override
-                    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
-                        if (e.getMessage() instanceof ChannelBuffer) {
-                            ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
-                            for (int i = 0; i < buffer.readableBytes(); ++i) {
-                                counter.countDown();
-                                if (counter.getCount() > 0) {
-                                    sendMessage(ctx, data);
-                                } else {
-                                    ctx.getChannel().close();
-                                }
-                            }
-                        } else {
-                            throw new IllegalArgumentException(e.getMessage().getClass().getName());
-                        }
-                    }
-
-                    @Override
-                    public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
-                        sendMessage(ctx, data);
-                    }
-
-                });
-            }
-        });
-        bootstrap.connect(new InetSocketAddress(port));
-    }
-
-    /**
-     * {@inheritedDoc}
-     */
-    public void stop() throws IOException {
-        factory.releaseExternalResources();
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/NettyBenchmarkServer.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/NettyBenchmarkServer.java b/benchmarks/src/test/java/org/apache/mina/core/NettyBenchmarkServer.java
deleted file mode 100644
index 44860a3..0000000
--- a/benchmarks/src/test/java/org/apache/mina/core/NettyBenchmarkServer.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.core;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.netty.bootstrap.ServerBootstrap;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelFactory;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.channel.ChannelPipelineFactory;
-import org.jboss.netty.channel.ChannelStateEvent;
-import org.jboss.netty.channel.Channels;
-import org.jboss.netty.channel.ChildChannelStateEvent;
-import org.jboss.netty.channel.ExceptionEvent;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
-import org.jboss.netty.channel.group.ChannelGroup;
-import org.jboss.netty.channel.group.DefaultChannelGroup;
-import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class NettyBenchmarkServer implements BenchmarkServer {
-
-    private static enum State {
-        WAIT_FOR_FIRST_BYTE_LENGTH, WAIT_FOR_SECOND_BYTE_LENGTH, WAIT_FOR_THIRD_BYTE_LENGTH, WAIT_FOR_FOURTH_BYTE_LENGTH, READING
-    }
-
-    private static final ChannelBuffer ACK = ChannelBuffers.buffer(1);
-
-    static {
-        ACK.writeByte(0);
-    }
-
-    private static final String STATE_ATTRIBUTE = NettyBenchmarkServer.class.getName() + ".state";
-
-    private static final String LENGTH_ATTRIBUTE = NettyBenchmarkServer.class.getName() + ".length";
-
-    private ChannelFactory factory;
-
-    private ChannelGroup allChannels = new DefaultChannelGroup();
-
-    /**
-     * Allocate a map as attachment for storing attributes.
-     * 
-     * @param ctx the channel context
-     * @return the map from the attachment
-     */
-    protected static Map<String, Object> getAttributesMap(ChannelHandlerContext ctx) {
-        Map<String, Object> map = (Map<String, Object>) ctx.getAttachment();
-        if (map == null) {
-            map = new HashMap<String, Object>();
-            ctx.setAttachment(map);
-        }
-        return map;
-    }
-
-    private static void setAttribute(ChannelHandlerContext ctx, String name, Object value) {
-        getAttributesMap(ctx).put(name, value);
-    }
-
-    private static Object getAttribute(ChannelHandlerContext ctx, String name) {
-        return getAttributesMap(ctx).get(name);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void start(int port) throws IOException {
-        factory = new NioServerSocketChannelFactory();
-        ServerBootstrap bootstrap = new ServerBootstrap(factory);
-        bootstrap.setOption("receiveBufferSize", 128 * 1024);
-        bootstrap.setOption("tcpNoDelay", true);
-        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
-            public ChannelPipeline getPipeline() throws Exception {
-                return Channels.pipeline(new SimpleChannelUpstreamHandler() {
-                    @Override
-                    public void childChannelOpen(ChannelHandlerContext ctx, ChildChannelStateEvent e) throws Exception {
-                        System.out.println("childChannelOpen");
-                        setAttribute(ctx, STATE_ATTRIBUTE, State.WAIT_FOR_FIRST_BYTE_LENGTH);
-                    }
-
-                    @Override
-                    public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
-                        System.out.println("channelOpen");
-                        setAttribute(ctx, STATE_ATTRIBUTE, State.WAIT_FOR_FIRST_BYTE_LENGTH);
-                        allChannels.add(ctx.getChannel());
-                    }
-
-                    @Override
-                    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
-                        if (e.getMessage() instanceof ChannelBuffer) {
-                            ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
-
-                            State state = (State) getAttribute(ctx, STATE_ATTRIBUTE);
-                            int length = 0;
-                            if (getAttributesMap(ctx).containsKey(LENGTH_ATTRIBUTE)) {
-                                length = (Integer) getAttribute(ctx, LENGTH_ATTRIBUTE);
-                            }
-                            while (buffer.readableBytes() > 0) {
-                                switch (state) {
-                                case WAIT_FOR_FIRST_BYTE_LENGTH:
-                                    length = (buffer.readByte() & 255) << 24;
-                                    state = State.WAIT_FOR_SECOND_BYTE_LENGTH;
-                                    break;
-                                case WAIT_FOR_SECOND_BYTE_LENGTH:
-                                    length += (buffer.readByte() & 255) << 16;
-                                    state = State.WAIT_FOR_THIRD_BYTE_LENGTH;
-                                    break;
-                                case WAIT_FOR_THIRD_BYTE_LENGTH:
-                                    length += (buffer.readByte() & 255) << 8;
-                                    state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
-                                    break;
-                                case WAIT_FOR_FOURTH_BYTE_LENGTH:
-                                    length += (buffer.readByte() & 255);
-                                    state = State.READING;
-                                    if ((length == 0) && (buffer.readableBytes() == 0)) {
-                                        ctx.getChannel().write(ACK.slice());
-                                        state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
-                                    }
-                                    break;
-                                case READING:
-                                    int remaining = buffer.readableBytes();
-                                    if (length > remaining) {
-                                        length -= remaining;
-                                        buffer.skipBytes(remaining);
-                                    } else {
-                                        buffer.skipBytes(length);
-                                        ctx.getChannel().write(ACK.slice());
-                                        state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
-                                        length = 0;
-                                    }
-                                }
-                            }
-                            setAttribute(ctx, STATE_ATTRIBUTE, state);
-                            setAttribute(ctx, LENGTH_ATTRIBUTE, length);
-                        }
-                    }
-
-                    @Override
-                    public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
-                        allChannels.remove(ctx.getChannel());
-                    }
-
-                    @Override
-                    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
-                        e.getCause().printStackTrace();
-                    }
-                });
-            }
-        });
-        allChannels.add(bootstrap.bind(new InetSocketAddress(port)));
-    }
-
-    /**
-     * {@inheritedDoc}
-     */
-    public void stop() throws IOException {
-        allChannels.disconnect().awaitUninterruptibly();
-        factory.releaseExternalResources();
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/NettyClientVsMinaServerBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/NettyClientVsMinaServerBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/NettyClientVsMinaServerBenchmarkBinaryTest.java
deleted file mode 100644
index eaa5c88..0000000
--- a/benchmarks/src/test/java/org/apache/mina/core/NettyClientVsMinaServerBenchmarkBinaryTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.core;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.mina.core.BenchmarkFactory.Type;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class NettyClientVsMinaServerBenchmarkBinaryTest
-    extends BenchmarkBinaryTest {
-
-    /**
-     * @param numberOfMessages
-     * @param messageSize
-     */
-    public NettyClientVsMinaServerBenchmarkBinaryTest( int numberOfMessages, int messageSize, int timeout ) {
-        super( numberOfMessages, messageSize, timeout );
-    }
-
-    /** {@inheritDoc}
-     */
-    @Override
-    public Type getClientType() {
-        return Type.Netty;
-    }
-
-    /** {@inheritDoc}
-     */
-    @Override
-    public Type getServerType() {
-        return Type.Mina;
-    }
-    
-    //TODO: analyze with Netty is so slow on large message: last test lower to 100 messages
-    @Parameters(name="{0} messages of size {1}")
-    public static Collection<Object[]> getParameters() {
-        Object[][] parameters = new Object[][] { 
-                { 1000000, 10, 2 * 60 }, 
-                { 1000000, 1 * 1024, 2 * 60 },
-                { 1000000, 10 * 1024, 2 * 60 }, 
-                { 1000000, 20 * 1024, 2 * 60 }, 
-                {  500000, 50 * 1024, 2 * 60 }, 
-                {  200000, 100 * 1024, 2 * 60 }, 
-                {  100000, 200 * 1024, 2 * 60 }, 
-                {   50000, 500 * 1024, 2 * 60 }, 
-                {   20000, 1024 * 1024, 2 * 60 }, 
-                {    2000, 10 * 1024* 1024, 2 * 60 }, 
-                {    500, 64 * 1024 * 1024, 2 * 60 } 
-        };
-        return Arrays.asList(parameters);
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/NettyClientVsNettyServerBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/NettyClientVsNettyServerBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/NettyClientVsNettyServerBenchmarkBinaryTest.java
deleted file mode 100644
index ba57b40..0000000
--- a/benchmarks/src/test/java/org/apache/mina/core/NettyClientVsNettyServerBenchmarkBinaryTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.core;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.mina.core.BenchmarkFactory.Type;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class NettyClientVsNettyServerBenchmarkBinaryTest
-    extends BenchmarkBinaryTest {
-
-    /**
-     * @param numberOfMessages
-     * @param messageSize
-     */
-    public NettyClientVsNettyServerBenchmarkBinaryTest( int numberOfMessages, int messageSize, int timeout ) {
-        super( numberOfMessages, messageSize, timeout );
-    }
-
-    /** {@inheritDoc}
-     */
-    @Override
-    public Type getClientType() {
-        return Type.Netty;
-    }
-
-    /** {@inheritDoc}
-     */
-    @Override
-    public Type getServerType() {
-        return Type.Netty;
-    }
-    
-    //TODO: analyze with Netty is so slow on large message: last test lower to 100 messages
-    @Parameters(name="{0} messages of size {1}")
-    public static Collection<Object[]> getParameters() {
-        Object[][] parameters = new Object[][] { 
-                { 1000000, 10, 2 * 60 }, 
-                { 1000000, 1 * 1024, 2 * 60 },
-                { 1000000, 10 * 1024, 2 * 60 }, 
-                { 1000000, 20 * 1024, 2 * 60 }, 
-                {  500000, 50 * 1024, 2 * 60 }, 
-                {  200000, 100 * 1024, 2 * 60 }, 
-                {  100000, 200 * 1024, 2 * 60 }, 
-                {   50000, 500 * 1024, 2 * 60 }, 
-                {   20000, 1024 * 1024, 2 * 60 }, 
-                {    2000, 10 * 1024* 1024, 2 * 60 }, 
-                {    500, 64 * 1024 * 1024, 2 * 60 } 
-        };
-        return Arrays.asList(parameters);
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Mina3TcpBenchmarkClient.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Mina3TcpBenchmarkClient.java b/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Mina3TcpBenchmarkClient.java
new file mode 100755
index 0000000..98fa5bb
--- /dev/null
+++ b/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Mina3TcpBenchmarkClient.java
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core.nio.tcp;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.mina.api.IdleStatus;
+import org.apache.mina.api.IoHandler;
+import org.apache.mina.api.IoService;
+import org.apache.mina.api.IoSession;
+import org.apache.mina.core.BenchmarkClient;
+import org.apache.mina.transport.nio.NioTcpClient;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Mina3TcpBenchmarkClient implements BenchmarkClient {
+    // The TCP client
+    private NioTcpClient client;
+
+    /**
+     * {@inheritDoc}
+     */
+    public void start(int port, final CountDownLatch counter, final byte[] data) throws IOException {
+        client = new NioTcpClient();
+        client.getSessionConfig().setSendBufferSize(64 * 1024);
+        client.getSessionConfig().setTcpNoDelay(true);
+        client.setIoHandler(new IoHandler() {
+            private void sendMessage(IoSession session, byte[] data) {
+                ByteBuffer iobuf = ByteBuffer.wrap(data);
+                session.write(iobuf);
+            }
+
+            public void sessionOpened(IoSession session) {
+                //System.out.println("Client session opened");
+                sendMessage(session, data);
+            }
+
+            public void messageReceived(IoSession session, Object message) {
+                //System.out.println("Client message received : " + message);
+                if (message instanceof ByteBuffer) {
+                    ByteBuffer buffer = (ByteBuffer) message;
+                    //System.out.println("length=" + buffer.remaining());
+                    for (int i = 0; i < buffer.remaining(); ++i) {
+                        counter.countDown();
+                        long count = counter.getCount();
+                        if (count > 0) {
+                            sendMessage(session, data);
+                            if (count % 100000 == 0) {
+                                System.out.println("Received " + count);
+                            }
+                        }
+                    }
+                }
+            }
+
+            public void exceptionCaught(IoSession session, Throwable cause) {
+                cause.printStackTrace();
+            }
+
+            @Override
+            public void sessionClosed(IoSession session) {
+            }
+
+            @Override
+            public void sessionIdle(IoSession session, IdleStatus status) {
+            }
+
+            @Override
+            public void messageSent(IoSession session, Object message) {
+                //System.out.println("Client message sent : " + message);
+            }
+
+            @Override
+            public void serviceActivated(IoService service) {
+            }
+
+            @Override
+            public void serviceInactivated(IoService service) {
+            }
+        });
+
+        client.connect(new InetSocketAddress(port));
+    }
+
+    /**
+     * {@inheritedDoc}
+     */
+    public void stop() throws IOException {
+        client.disconnect();
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Mina3TcpBenchmarkServer.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Mina3TcpBenchmarkServer.java b/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Mina3TcpBenchmarkServer.java
new file mode 100755
index 0000000..4443a00
--- /dev/null
+++ b/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Mina3TcpBenchmarkServer.java
@@ -0,0 +1,158 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core.nio.tcp;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.api.IdleStatus;
+import org.apache.mina.api.IoHandler;
+import org.apache.mina.api.IoService;
+import org.apache.mina.api.IoSession;
+import org.apache.mina.core.BenchmarkServer;
+import org.apache.mina.session.AttributeKey;
+import org.apache.mina.transport.nio.NioTcpServer;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Mina3TcpBenchmarkServer implements BenchmarkServer {
+
+    private static enum State {
+        WAIT_FOR_FIRST_BYTE_LENGTH, WAIT_FOR_SECOND_BYTE_LENGTH, WAIT_FOR_THIRD_BYTE_LENGTH, WAIT_FOR_FOURTH_BYTE_LENGTH, READING
+    }
+
+    private static final ByteBuffer ACK = ByteBuffer.allocate(1);
+
+    static {
+        ACK.put((byte) 0);
+        ACK.rewind();
+    }
+
+    private static final AttributeKey<State> STATE_ATTRIBUTE = new AttributeKey<State>(State.class,
+            Mina3TcpBenchmarkServer.class.getName() + ".state");
+
+    private static final AttributeKey<Integer> LENGTH_ATTRIBUTE = new AttributeKey<Integer>(Integer.class,
+            Mina3TcpBenchmarkServer.class.getName() + ".length");
+
+    private NioTcpServer tcpServer;
+
+    /**
+     * {@inheritDoc}
+     */
+    public void start(int port) throws IOException {
+        tcpServer = new NioTcpServer();
+        tcpServer.getSessionConfig().setReadBufferSize(128 * 1024);
+        tcpServer.getSessionConfig().setTcpNoDelay(true);
+        tcpServer.setIoHandler(new IoHandler() {
+            public void sessionOpened(IoSession session) {
+                //System.out.println("Server session opened");
+                session.setAttribute(STATE_ATTRIBUTE, State.WAIT_FOR_FIRST_BYTE_LENGTH);
+            }
+
+            public void messageReceived(IoSession session, Object message) {
+                //System.out.println("Server Message received : " + message);
+                if (message instanceof ByteBuffer) {
+                    ByteBuffer buffer = (ByteBuffer) message;
+
+                    State state = session.getAttribute(STATE_ATTRIBUTE);
+                    int length = 0;
+
+                    if (session.getAttribute(LENGTH_ATTRIBUTE) != null) {
+                        length = session.getAttribute(LENGTH_ATTRIBUTE);
+                    }
+
+                    while (buffer.remaining() > 0) {
+                        switch (state) {
+                        case WAIT_FOR_FIRST_BYTE_LENGTH:
+                            length = (buffer.get() & 255) << 24;
+                            state = State.WAIT_FOR_SECOND_BYTE_LENGTH;
+                            break;
+                        case WAIT_FOR_SECOND_BYTE_LENGTH:
+                            length += (buffer.get() & 255) << 16;
+                            state = State.WAIT_FOR_THIRD_BYTE_LENGTH;
+                            break;
+                        case WAIT_FOR_THIRD_BYTE_LENGTH:
+                            length += (buffer.get() & 255) << 8;
+                            state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
+                            break;
+                        case WAIT_FOR_FOURTH_BYTE_LENGTH:
+                            length += (buffer.get() & 255);
+                            state = State.READING;
+                            if ((length == 0) && (buffer.remaining() == 0)) {
+                                session.write(ACK.slice());
+                                state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
+                            }
+                            break;
+                        case READING:
+                            int remaining = buffer.remaining();
+                            if (length > remaining) {
+                                length -= remaining;
+                                buffer.position(buffer.position() + remaining);
+                            } else {
+                                buffer.position(buffer.position() + length);
+                                session.write(ACK.slice());
+                                state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
+                                length = 0;
+                            }
+                        }
+                    }
+                    session.setAttribute(LENGTH_ATTRIBUTE, length);
+                    session.setAttribute(STATE_ATTRIBUTE, state);
+                }
+            }
+
+            public void exceptionCaught(IoSession session, Throwable cause) {
+                cause.printStackTrace();
+            }
+
+            @Override
+            public void sessionClosed(IoSession session) {
+            }
+
+            @Override
+            public void sessionIdle(IoSession session, IdleStatus status) {
+            }
+
+            @Override
+            public void messageSent(IoSession session, Object message) {
+                //System.out.println("Server message sent :" + message);
+            }
+
+            @Override
+            public void serviceActivated(IoService service) {
+            }
+
+            @Override
+            public void serviceInactivated(IoService service) {
+            }
+        });
+
+        tcpServer.bind(new InetSocketAddress(port));
+    }
+
+    /**
+     * {@inheritedDoc}
+     */
+    public void stop() throws IOException {
+        tcpServer.unbind();
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Netty3TcpBenchmarkClient.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Netty3TcpBenchmarkClient.java b/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Netty3TcpBenchmarkClient.java
new file mode 100644
index 0000000..cd712be
--- /dev/null
+++ b/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Netty3TcpBenchmarkClient.java
@@ -0,0 +1,103 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core.nio.tcp;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.mina.core.BenchmarkClient;
+import org.jboss.netty.bootstrap.ClientBootstrap;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.Channels;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
+import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Netty3TcpBenchmarkClient implements BenchmarkClient {
+
+    private ChannelFactory factory;
+
+    /**
+     * 
+     */
+    public Netty3TcpBenchmarkClient() {
+    }
+
+    /**
+     * {@inheritedDoc}
+     */
+    public void start(final int port, final CountDownLatch counter, final byte[] data) throws IOException {
+        factory = new NioClientSocketChannelFactory();
+        ClientBootstrap bootstrap = new ClientBootstrap(factory);
+        bootstrap.setOption("sendBufferSize", 64 * 1024);
+        bootstrap.setOption("tcpNoDelay", true);
+        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
+            public ChannelPipeline getPipeline() throws Exception {
+                return Channels.pipeline(new SimpleChannelUpstreamHandler() {
+                    private void sendMessage(ChannelHandlerContext ctx, byte[] data) {
+                        ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(data);
+                        ctx.getChannel().write(buffer);
+                    }
+
+                    @Override
+                    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
+                        if (e.getMessage() instanceof ChannelBuffer) {
+                            ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
+                            for (int i = 0; i < buffer.readableBytes(); ++i) {
+                                counter.countDown();
+                                if (counter.getCount() > 0) {
+                                    sendMessage(ctx, data);
+                                } else {
+                                    ctx.getChannel().close();
+                                }
+                            }
+                        } else {
+                            throw new IllegalArgumentException(e.getMessage().getClass().getName());
+                        }
+                    }
+
+                    @Override
+                    public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
+                        sendMessage(ctx, data);
+                    }
+
+                });
+            }
+        });
+        bootstrap.connect(new InetSocketAddress(port));
+    }
+
+    /**
+     * {@inheritedDoc}
+     */
+    public void stop() throws IOException {
+        factory.releaseExternalResources();
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/626868af/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Netty3TcpBenchmarkServer.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Netty3TcpBenchmarkServer.java b/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Netty3TcpBenchmarkServer.java
new file mode 100644
index 0000000..f529ff4
--- /dev/null
+++ b/benchmarks/src/test/java/org/apache/mina/core/nio/tcp/Netty3TcpBenchmarkServer.java
@@ -0,0 +1,187 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core.nio.tcp;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.mina.core.BenchmarkServer;
+import org.jboss.netty.bootstrap.ServerBootstrap;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.Channels;
+import org.jboss.netty.channel.ChildChannelStateEvent;
+import org.jboss.netty.channel.ExceptionEvent;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
+import org.jboss.netty.channel.group.ChannelGroup;
+import org.jboss.netty.channel.group.DefaultChannelGroup;
+import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Netty3TcpBenchmarkServer implements BenchmarkServer {
+
+    private static enum State {
+        WAIT_FOR_FIRST_BYTE_LENGTH, WAIT_FOR_SECOND_BYTE_LENGTH, WAIT_FOR_THIRD_BYTE_LENGTH, WAIT_FOR_FOURTH_BYTE_LENGTH, READING
+    }
+
+    private static final ChannelBuffer ACK = ChannelBuffers.buffer(1);
+
+    static {
+        ACK.writeByte(0);
+    }
+
+    private static final String STATE_ATTRIBUTE = Netty3TcpBenchmarkServer.class.getName() + ".state";
+
+    private static final String LENGTH_ATTRIBUTE = Netty3TcpBenchmarkServer.class.getName() + ".length";
+
+    private ChannelFactory factory;
+
+    private ChannelGroup allChannels = new DefaultChannelGroup();
+
+    /**
+     * Allocate a map as attachment for storing attributes.
+     * 
+     * @param ctx the channel context
+     * @return the map from the attachment
+     */
+    protected static Map<String, Object> getAttributesMap(ChannelHandlerContext ctx) {
+        Map<String, Object> map = (Map<String, Object>) ctx.getAttachment();
+        if (map == null) {
+            map = new HashMap<String, Object>();
+            ctx.setAttachment(map);
+        }
+        return map;
+    }
+
+    private static void setAttribute(ChannelHandlerContext ctx, String name, Object value) {
+        getAttributesMap(ctx).put(name, value);
+    }
+
+    private static Object getAttribute(ChannelHandlerContext ctx, String name) {
+        return getAttributesMap(ctx).get(name);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void start(int port) throws IOException {
+        factory = new NioServerSocketChannelFactory();
+        ServerBootstrap bootstrap = new ServerBootstrap(factory);
+        bootstrap.setOption("receiveBufferSize", 128 * 1024);
+        bootstrap.setOption("tcpNoDelay", true);
+        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
+            public ChannelPipeline getPipeline() throws Exception {
+                return Channels.pipeline(new SimpleChannelUpstreamHandler() {
+                    @Override
+                    public void childChannelOpen(ChannelHandlerContext ctx, ChildChannelStateEvent e) throws Exception {
+                        System.out.println("childChannelOpen");
+                        setAttribute(ctx, STATE_ATTRIBUTE, State.WAIT_FOR_FIRST_BYTE_LENGTH);
+                    }
+
+                    @Override
+                    public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
+                        System.out.println("channelOpen");
+                        setAttribute(ctx, STATE_ATTRIBUTE, State.WAIT_FOR_FIRST_BYTE_LENGTH);
+                        allChannels.add(ctx.getChannel());
+                    }
+
+                    @Override
+                    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
+                        if (e.getMessage() instanceof ChannelBuffer) {
+                            ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
+
+                            State state = (State) getAttribute(ctx, STATE_ATTRIBUTE);
+                            int length = 0;
+                            if (getAttributesMap(ctx).containsKey(LENGTH_ATTRIBUTE)) {
+                                length = (Integer) getAttribute(ctx, LENGTH_ATTRIBUTE);
+                            }
+                            while (buffer.readableBytes() > 0) {
+                                switch (state) {
+                                case WAIT_FOR_FIRST_BYTE_LENGTH:
+                                    length = (buffer.readByte() & 255) << 24;
+                                    state = State.WAIT_FOR_SECOND_BYTE_LENGTH;
+                                    break;
+                                case WAIT_FOR_SECOND_BYTE_LENGTH:
+                                    length += (buffer.readByte() & 255) << 16;
+                                    state = State.WAIT_FOR_THIRD_BYTE_LENGTH;
+                                    break;
+                                case WAIT_FOR_THIRD_BYTE_LENGTH:
+                                    length += (buffer.readByte() & 255) << 8;
+                                    state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
+                                    break;
+                                case WAIT_FOR_FOURTH_BYTE_LENGTH:
+                                    length += (buffer.readByte() & 255);
+                                    state = State.READING;
+                                    if ((length == 0) && (buffer.readableBytes() == 0)) {
+                                        ctx.getChannel().write(ACK.slice());
+                                        state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
+                                    }
+                                    break;
+                                case READING:
+                                    int remaining = buffer.readableBytes();
+                                    if (length > remaining) {
+                                        length -= remaining;
+                                        buffer.skipBytes(remaining);
+                                    } else {
+                                        buffer.skipBytes(length);
+                                        ctx.getChannel().write(ACK.slice());
+                                        state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
+                                        length = 0;
+                                    }
+                                }
+                            }
+                            setAttribute(ctx, STATE_ATTRIBUTE, state);
+                            setAttribute(ctx, LENGTH_ATTRIBUTE, length);
+                        }
+                    }
+
+                    @Override
+                    public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
+                        allChannels.remove(ctx.getChannel());
+                    }
+
+                    @Override
+                    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
+                        e.getCause().printStackTrace();
+                    }
+                });
+            }
+        });
+        allChannels.add(bootstrap.bind(new InetSocketAddress(port)));
+    }
+
+    /**
+     * {@inheritedDoc}
+     */
+    public void stop() throws IOException {
+        allChannels.disconnect().awaitUninterruptibly();
+        factory.releaseExternalResources();
+    }
+}