http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java
index aba17f3..4f67c3a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java
@@ -74,21 +74,21 @@ public class GridStreamerCancelRequest extends 
MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("all")
     @Override public boolean writeTo(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        writer.setBuffer(buf);
 
-        if (!commState.typeWritten) {
-            if (!commState.putByte(null, directType()))
+        if (!typeWritten) {
+            if (!writer.writeByte(null, directType()))
                 return false;
 
-            commState.typeWritten = true;
+            typeWritten = true;
         }
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                if (!commState.putGridUuid("cancelledFutId", cancelledFutId))
+                if (!writer.writeIgniteUuid("cancelledFutId", cancelledFutId))
                     return false;
 
-                commState.idx++;
+                state++;
 
         }
 
@@ -98,16 +98,16 @@ public class GridStreamerCancelRequest extends 
MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("all")
     @Override public boolean readFrom(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        reader.setBuffer(buf);
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                cancelledFutId = commState.getGridUuid("cancelledFutId");
+                cancelledFutId = reader.readIgniteUuid("cancelledFutId");
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
index e10ef04..90e7163 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
@@ -175,89 +175,57 @@ public class GridStreamerExecutionRequest extends 
MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("all")
     @Override public boolean writeTo(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        writer.setBuffer(buf);
 
-        if (!commState.typeWritten) {
-            if (!commState.putByte(null, directType()))
+        if (!typeWritten) {
+            if (!writer.writeByte(null, directType()))
                 return false;
 
-            commState.typeWritten = true;
+            typeWritten = true;
         }
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                if (!commState.putByteArray("batchBytes", batchBytes))
+                if (!writer.writeByteArray("batchBytes", batchBytes))
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 1:
-                if (!commState.putGridUuid("clsLdrId", clsLdrId))
+                if (!writer.writeIgniteUuid("clsLdrId", clsLdrId))
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 2:
-                if (!commState.putEnum("depMode", depMode))
+                if (!writer.writeEnum("depMode", depMode))
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 3:
-                if (!commState.putBoolean("forceLocDep", forceLocDep))
+                if (!writer.writeBoolean("forceLocDep", forceLocDep))
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 4:
-                if (ldrParticipants != null) {
-                    if (commState.it == null) {
-                        if (!commState.putInt(null, ldrParticipants.size()))
-                            return false;
-
-                        commState.it = ldrParticipants.entrySet().iterator();
-                    }
-
-                    while (commState.it.hasNext() || commState.cur != NULL) {
-                        if (commState.cur == NULL)
-                            commState.cur = commState.it.next();
-
-                        Map.Entry<UUID, IgniteUuid> e = (Map.Entry<UUID, 
IgniteUuid>)commState.cur;
-
-                        if (!commState.keyDone) {
-                            if (!commState.putUuid(null, e.getKey()))
-                                return false;
-
-                            commState.keyDone = true;
-                        }
-
-                        if (!commState.putGridUuid(null, e.getValue()))
-                            return false;
-
-                        commState.keyDone = false;
-
-                        commState.cur = NULL;
-                    }
-
-                    commState.it = null;
-                } else {
-                    if (!commState.putInt(null, -1))
-                        return false;
-                }
+                if (!writer.writeMap("ldrParticipants", ldrParticipants, 
UUID.class, IgniteUuid.class))
+                    return false;
 
-                commState.idx++;
+                state++;
 
             case 5:
-                if (!commState.putString("sampleClsName", sampleClsName))
+                if (!writer.writeString("sampleClsName", sampleClsName))
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 6:
-                if (!commState.putString("userVer", userVer))
+                if (!writer.writeString("userVer", userVer))
                     return false;
 
-                commState.idx++;
+                state++;
 
         }
 
@@ -267,101 +235,64 @@ public class GridStreamerExecutionRequest extends 
MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("all")
     @Override public boolean readFrom(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        reader.setBuffer(buf);
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                batchBytes = commState.getByteArray("batchBytes");
+                batchBytes = reader.readByteArray("batchBytes");
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 1:
-                clsLdrId = commState.getGridUuid("clsLdrId");
+                clsLdrId = reader.readIgniteUuid("clsLdrId");
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 2:
-                byte depMode0 = commState.getByte("depMode");
+                depMode = reader.readEnum("depMode", DeploymentMode.class);
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                depMode = DeploymentMode.fromOrdinal(depMode0);
-
-                commState.idx++;
+                state++;
 
             case 3:
-                forceLocDep = commState.getBoolean("forceLocDep");
+                forceLocDep = reader.readBoolean("forceLocDep");
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 4:
-                if (commState.readSize == -1) {
-                    int _val = commState.getInt(null);
+                ldrParticipants = reader.readMap("ldrParticipants", 
UUID.class, IgniteUuid.class);
 
-                    if (!commState.lastRead())
-                        return false;
-                    commState.readSize = _val;
-                }
-
-                if (commState.readSize >= 0) {
-                    if (ldrParticipants == null)
-                        ldrParticipants = new HashMap<>(commState.readSize, 
1.0f);
-
-                    for (int i = commState.readItems; i < commState.readSize; 
i++) {
-                        if (!commState.keyDone) {
-                            UUID _val = commState.getUuid(null);
-
-                            if (!commState.lastRead())
-                                return false;
-
-                            commState.cur = _val;
-                            commState.keyDone = true;
-                        }
-
-                        IgniteUuid _val = commState.getGridUuid(null);
-
-                        if (!commState.lastRead())
-                            return false;
-
-                        ldrParticipants.put((UUID)commState.cur, _val);
-
-                        commState.keyDone = false;
-
-                        commState.readItems++;
-                    }
-                }
-
-                commState.readSize = -1;
-                commState.readItems = 0;
-                commState.cur = null;
+                if (!reader.isLastRead())
+                    return false;
 
-                commState.idx++;
+                state++;
 
             case 5:
-                sampleClsName = commState.getString("sampleClsName");
+                sampleClsName = reader.readString("sampleClsName");
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 6:
-                userVer = commState.getString("userVer");
+                userVer = reader.readString("userVer");
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java
index a9c05c5..fc6da7f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java
@@ -95,27 +95,27 @@ public class GridStreamerResponse extends MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("all")
     @Override public boolean writeTo(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        writer.setBuffer(buf);
 
-        if (!commState.typeWritten) {
-            if (!commState.putByte(null, directType()))
+        if (!typeWritten) {
+            if (!writer.writeByte(null, directType()))
                 return false;
 
-            commState.typeWritten = true;
+            typeWritten = true;
         }
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                if (!commState.putByteArray("errBytes", errBytes))
+                if (!writer.writeByteArray("errBytes", errBytes))
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 1:
-                if (!commState.putGridUuid("futId", futId))
+                if (!writer.writeIgniteUuid("futId", futId))
                     return false;
 
-                commState.idx++;
+                state++;
 
         }
 
@@ -125,24 +125,24 @@ public class GridStreamerResponse extends MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("all")
     @Override public boolean readFrom(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        reader.setBuffer(buf);
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                errBytes = commState.getByteArray("errBytes");
+                errBytes = reader.readByteArray("errBytes");
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 1:
-                futId = commState.getGridUuid("futId");
+                futId = reader.readIgniteUuid("futId");
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java
deleted file mode 100644
index 9895f43..0000000
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java
+++ /dev/null
@@ -1,46 +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.ignite.internal.processors.version;
-
-import org.apache.ignite.internal.direct.*;
-
-import java.nio.*;
-
-/**
- * Version converter.
- */
-public abstract class GridVersionConverter {
-    /** State. */
-    protected final GridTcpCommunicationMessageState commState = new 
GridTcpCommunicationMessageState();
-
-    /**
-     * Writes delta between two versions.
-     *
-     * @param buf Buffer to write to.
-     * @return Whether delta was fully written.
-     */
-    public abstract boolean writeTo(ByteBuffer buf);
-
-    /**
-     * Reads delta between two versions.
-     *
-     * @param buf Buffer to read from.
-     * @return Whether delta was fully read.
-     */
-    public abstract boolean readFrom(ByteBuffer buf);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java
index 9cff49c..8ec78d5 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java
@@ -408,12 +408,57 @@ public class GridByteArrayList extends MessageAdapter 
implements Externalizable
 
     /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf) {
-        return false; // TODO: implement.
+        writer.setBuffer(buf);
+
+        if (!typeWritten) {
+            if (!writer.writeByte(null, directType()))
+                return false;
+
+            typeWritten = true;
+        }
+
+        switch (state) {
+            case 0:
+                if (!writer.writeByteArray("data", data))
+                    return false;
+
+                state++;
+
+            case 1:
+                if (!writer.writeInt("size", size))
+                    return false;
+
+                state++;
+
+        }
+
+        return true;
     }
 
     /** {@inheritDoc} */
     @Override public boolean readFrom(ByteBuffer buf) {
-        return false; // TODO: implement.
+        reader.setBuffer(buf);
+
+        switch (state) {
+            case 0:
+                data = reader.readByteArray("data");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                state++;
+
+            case 1:
+                size = reader.readInt("size");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                state++;
+
+        }
+
+        return true;
     }
 
     /** {@inheritDoc} */
@@ -423,12 +468,19 @@ public class GridByteArrayList extends MessageAdapter 
implements Externalizable
 
     /** {@inheritDoc} */
     @Override public MessageAdapter clone() {
-        return null; // TODO: implement.
+        GridByteArrayList _clone = new GridByteArrayList();
+
+        clone0(_clone);
+
+        return _clone;
     }
 
     /** {@inheritDoc} */
     @Override protected void clone0(MessageAdapter _msg) {
-        // TODO: implement.
+        GridByteArrayList _clone = (GridByteArrayList)_msg;
+
+        _clone.data = data;
+        _clone.size = size;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java 
b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
index 2525467..5dce4e9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
@@ -506,12 +506,57 @@ public class GridLongList extends MessageAdapter 
implements Externalizable {
 
     /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf) {
-        return false; // TODO: implement.
+        writer.setBuffer(buf);
+
+        if (!typeWritten) {
+            if (!writer.writeByte(null, directType()))
+                return false;
+
+            typeWritten = true;
+        }
+
+        switch (state) {
+            case 0:
+                if (!writer.writeLongArray("arr", arr))
+                    return false;
+
+                state++;
+
+            case 1:
+                if (!writer.writeInt("idx", idx))
+                    return false;
+
+                state++;
+
+        }
+
+        return true;
     }
 
     /** {@inheritDoc} */
     @Override public boolean readFrom(ByteBuffer buf) {
-        return false; // TODO: implement.
+        reader.setBuffer(buf);
+
+        switch (state) {
+            case 0:
+                arr = reader.readLongArray("arr");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                state++;
+
+            case 1:
+                idx = reader.readInt("idx");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                state++;
+
+        }
+
+        return true;
     }
 
     /** {@inheritDoc} */
@@ -521,11 +566,18 @@ public class GridLongList extends MessageAdapter 
implements Externalizable {
 
     /** {@inheritDoc} */
     @Override public MessageAdapter clone() {
-        return null; // TODO: implement.
+        GridLongList _clone = new GridLongList();
+
+        clone0(_clone);
+
+        return _clone;
     }
 
     /** {@inheritDoc} */
     @Override protected void clone0(MessageAdapter _msg) {
-        // TODO: implement.
+        GridLongList _clone = (GridLongList)_msg;
+
+        _clone.arr = arr;
+        _clone.idx = idx;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
index 2234698..d393e16 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
@@ -17,24 +17,13 @@
 
 package org.apache.ignite.plugin.extensions.communication;
 
-import org.apache.ignite.internal.direct.*;
-
 import java.io.*;
 import java.nio.*;
-import java.util.*;
 
 /**
  * Communication message adapter.
  */
 public abstract class MessageAdapter implements Serializable, Cloneable {
-    /** */
-    // TODO: remove
-    protected static final Object NULL = new Object();
-
-    /** */
-    // TODO: remove
-    protected final GridTcpCommunicationMessageState commState = new 
GridTcpCommunicationMessageState();
-
     /** Writer. */
     protected MessageWriter writer;
 
@@ -64,17 +53,6 @@ public abstract class MessageAdapter implements 
Serializable, Cloneable {
     }
 
     /**
-     * @param buf Buffer.
-     */
-    public final void setBuffer(ByteBuffer buf) {
-        if (writer != null)
-            writer.setBuffer(buf);
-
-        if (reader != null)
-            reader.setBuffer(buf);
-    }
-
-    /**
      * @param buf Byte buffer.
      * @return Whether message was fully written.
      */
@@ -108,29 +86,4 @@ public abstract class MessageAdapter implements 
Serializable, Cloneable {
     public boolean skipRecovery() {
         return false;
     }
-
-    /**
-     * @param arr Array.
-     * @return Array iterator.
-     */
-    protected final Iterator<?> arrayIterator(final Object[] arr) {
-        return new Iterator<Object>() {
-            private int idx;
-
-            @Override public boolean hasNext() {
-                return idx < arr.length;
-            }
-
-            @Override public Object next() {
-                if (!hasNext())
-                    throw new NoSuchElementException();
-
-                return arr[idx++];
-            }
-
-            @Override public void remove() {
-                throw new UnsupportedOperationException();
-            }
-        };
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
 
b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
index eca6afb..db4d856 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
@@ -68,7 +68,7 @@ public interface MessageReader {
 
     public <C extends Collection<T>, T> C readCollection(String name, Class<T> 
itemCls);
 
-    public <K, V> Map<K, V> readMap(String name, Class<K> keyCls, Class<V> 
valCls);
+    public <M extends Map<K, V>, K, V> M readMap(String name, Class<K> keyCls, 
Class<V> valCls);
 
     public boolean isLastRead();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
index d468c28..9a3a0f0 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
@@ -74,21 +74,21 @@ public class JobStealingRequest extends MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("all")
     @Override public boolean writeTo(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        writer.setBuffer(buf);
 
-        if (!commState.typeWritten) {
-            if (!commState.putByte(null, directType()))
+        if (!typeWritten) {
+            if (!writer.writeByte(null, directType()))
                 return false;
 
-            commState.typeWritten = true;
+            typeWritten = true;
         }
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                if (!commState.putInt("delta", delta))
+                if (!writer.writeInt("delta", delta))
                     return false;
 
-                commState.idx++;
+                state++;
 
         }
 
@@ -98,16 +98,16 @@ public class JobStealingRequest extends MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("all")
     @Override public boolean readFrom(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        reader.setBuffer(buf);
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                delta = commState.getInt("delta");
+                delta = reader.readInt("delta");
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
index ce1d765..d99cdfd 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
@@ -156,9 +156,9 @@ public class GridCommunicationSendMessageSelfTest extends 
GridCommonAbstractTest
 
         /** {@inheritDoc} */
         @Override public boolean writeTo(ByteBuffer buf) {
-            commState.setBuffer(buf);
+            writer.setBuffer(buf);
 
-            return commState.putByte(null, directType());
+            return writer.writeByte(null, directType());
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/159c1e84/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
index e1244a0..9089e7c 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
@@ -116,39 +116,39 @@ public class GridTestMessage extends MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("fallthrough")
     @Override public boolean writeTo(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        writer.setBuffer(buf);
 
-        if (!commState.typeWritten) {
-            if (!commState.putByte(null, directType()))
+        if (!typeWritten) {
+            if (!writer.writeByte(null, directType()))
                 return false;
 
-            commState.typeWritten = true;
+            typeWritten = true;
         }
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                if (!commState.putUuid(null, srcNodeId))
+                if (!writer.writeUuid(null, srcNodeId))
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 1:
-                if (!commState.putLong(null, msgId))
+                if (!writer.writeLong(null, msgId))
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 2:
-                if (!commState.putLong(null, resId))
+                if (!writer.writeLong(null, resId))
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 3:
-                if (!commState.putByteArray(null, payload))
+                if (!writer.writeByteArray(null, payload))
                     return false;
 
-                commState.idx++;
+                state++;
         }
 
         return true;
@@ -157,40 +157,40 @@ public class GridTestMessage extends MessageAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("fallthrough")
     @Override public boolean readFrom(ByteBuffer buf) {
-        commState.setBuffer(buf);
+        reader.setBuffer(buf);
 
-        switch (commState.idx) {
+        switch (state) {
             case 0:
-                srcNodeId = commState.getUuid(null);
+                srcNodeId = reader.readUuid(null);
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
 
             case 1:
-                if (buf.remaining() < 8)
-                    return false;
+                msgId = reader.readLong(null);
 
-                msgId = commState.getLong(null);
+                if (!reader.isLastRead())
+                    return false;
 
-                commState.idx++;
+                state++;
 
             case 2:
-                if (buf.remaining() < 8)
-                    return false;
+                resId = reader.readLong(null);
 
-                resId = commState.getLong(null);
+                if (!reader.isLastRead())
+                    return false;
 
-                commState.idx++;
+                state++;
 
             case 3:
-                payload = commState.getByteArray(null);
+                payload = reader.readByteArray(null);
 
-                if (!commState.lastRead())
+                if (!reader.isLastRead())
                     return false;
 
-                commState.idx++;
+                state++;
         }
 
         return true;

Reply via email to