This is an automated email from the ASF dual-hosted git repository.

jorgebg pushed a commit to branch TINKERPOP-2305
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit a76cf5de34737a45c7c71749cfbbf6f3c589e5ac
Author: Jorge Bay Gondra <jorgebaygon...@gmail.com>
AuthorDate: Thu Oct 10 10:13:22 2019 +0200

    TINKERPOP-2305 Refactor serialization method signatures
---
 .../tinkerpop/gremlin/structure/io/Buffer.java     | 67 +++++++++++++++++++++-
 .../gremlin/structure/io/BufferFactory.java        | 39 +++++++++++++
 .../tinkerpop/gremlin/driver/NettyBuffer.java      | 65 +++++++++++++++++++++
 ...UUIDSerializer.java => NettyBufferFactory.java} | 29 +++++-----
 .../driver/ser/binary/GraphBinaryReader.java       | 10 ++--
 .../driver/ser/binary/GraphBinaryWriter.java       | 19 +++---
 .../ser/binary/RequestMessageSerializer.java       | 13 ++++-
 .../ser/binary/ResponseMessageSerializer.java      | 12 +++-
 .../gremlin/driver/ser/binary/TypeSerializer.java  | 11 ++--
 .../ser/binary/types/BigDecimalSerializer.java     |  6 +-
 .../ser/binary/types/BigIntegerSerializer.java     |  6 +-
 .../driver/ser/binary/types/BindingSerializer.java |  6 +-
 .../driver/ser/binary/types/BulkSetSerializer.java |  7 +--
 .../ser/binary/types/ByteBufferSerializer.java     |  6 +-
 .../ser/binary/types/ByteCodeSerializer.java       | 12 ++--
 .../driver/ser/binary/types/CharSerializer.java    |  7 +--
 .../driver/ser/binary/types/ClassSerializer.java   |  6 +-
 .../ser/binary/types/CollectionSerializer.java     |  6 +-
 .../driver/ser/binary/types/DateSerializer.java    |  6 +-
 .../ser/binary/types/DurationSerializer.java       |  6 +-
 .../driver/ser/binary/types/EdgeSerializer.java    |  6 +-
 .../driver/ser/binary/types/EnumSerializer.java    |  6 +-
 .../driver/ser/binary/types/GraphSerializer.java   | 11 ++--
 .../ser/binary/types/InetAddressSerializer.java    |  6 +-
 .../driver/ser/binary/types/InstantSerializer.java |  6 +-
 .../driver/ser/binary/types/LambdaSerializer.java  |  6 +-
 .../driver/ser/binary/types/ListSerializer.java    |  6 +-
 .../ser/binary/types/LocalDateSerializer.java      |  6 +-
 .../ser/binary/types/LocalDateTimeSerializer.java  |  6 +-
 .../ser/binary/types/LocalTimeSerializer.java      |  6 +-
 .../ser/binary/types/MapEntrySerializer.java       |  6 +-
 .../driver/ser/binary/types/MapSerializer.java     |  6 +-
 .../driver/ser/binary/types/MetricsSerializer.java |  6 +-
 .../ser/binary/types/MonthDaySerializer.java       |  6 +-
 .../ser/binary/types/OffsetDateTimeSerializer.java |  6 +-
 .../ser/binary/types/OffsetTimeSerializer.java     |  6 +-
 .../driver/ser/binary/types/PSerializer.java       |  6 +-
 .../driver/ser/binary/types/PathSerializer.java    |  6 +-
 .../driver/ser/binary/types/PeriodSerializer.java  |  6 +-
 .../ser/binary/types/PropertySerializer.java       |  6 +-
 .../driver/ser/binary/types/SetSerializer.java     |  6 +-
 .../ser/binary/types/SimpleTypeSerializer.java     | 14 ++---
 .../ser/binary/types/SingleTypeSerializer.java     | 28 ++++-----
 .../driver/ser/binary/types/StringSerializer.java  |  6 +-
 .../types/TraversalExplanationSerializer.java      |  6 +-
 .../binary/types/TraversalMetricsSerializer.java   |  6 +-
 .../binary/types/TraversalStrategySerializer.java  |  6 +-
 .../ser/binary/types/TraverserSerializer.java      |  6 +-
 .../driver/ser/binary/types/TreeSerializer.java    |  6 +-
 .../driver/ser/binary/types/UUIDSerializer.java    |  6 +-
 .../ser/binary/types/VertexPropertySerializer.java |  6 +-
 .../driver/ser/binary/types/VertexSerializer.java  |  6 +-
 .../ser/binary/types/YearMonthSerializer.java      |  6 +-
 .../ser/binary/types/ZoneOffsetSerializer.java     |  6 +-
 .../ser/binary/types/ZonedDateTimeSerializer.java  |  6 +-
 .../GraphBinaryReaderWriterRoundTripTest.java      |  6 +-
 .../ser/binary/TypeSerializerFailureTests.java     |  6 +-
 .../ser/binary/TypeSerializerRegistryTest.java     | 10 ++--
 .../ser/binary/types/CharSerializerTest.java       |  8 ++-
 .../types/sample/SamplePersonSerializer.java       | 10 ++--
 .../types/sample/SamplePersonSerializerTest.java   |  5 +-
 .../driver/GraphBinaryReaderWriterBenchmark.java   | 12 ++--
 .../graphbinary/GraphBinaryCompatibilityTest.java  |  9 +--
 63 files changed, 419 insertions(+), 231 deletions(-)

diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java
index 3219a90..4d37bba 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java
@@ -1,3 +1,21 @@
+/*
+ * 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.tinkerpop.gremlin.structure.io;
 
 import java.io.IOException;
@@ -10,6 +28,11 @@ import java.nio.ByteBuffer;
 public interface Buffer {
 
     /**
+     * Returns the number of readable bytes.
+     */
+    int readableBytes();
+
+    /**
      * Returns the reader index of this buffer.
      */
     int readerIndex();
@@ -29,18 +52,31 @@ public interface Buffer {
 
     /**
      * Sets the writer index of this buffer.
-     *
-     * @throws IndexOutOfBoundsException
-     *         if its out of bounds.
      */
     Buffer writerIndex(int writerIndex);
 
     /**
+     * Marks the current writer index in this buffer.
+     */
+    Buffer markWriterIndex();
+
+    /**
+     * Repositions the current writer index to the marked index in this buffer.
+     */
+    Buffer resetWriterIndex();
+
+    /**
      * Returns the number of bytes (octets) this buffer can contain.
      */
     int capacity();
 
     /**
+     * Returns {@code true} if and only if this buffer is backed by an
+     * NIO direct buffer.
+     */
+    boolean isDirect();
+
+    /**
      * Gets a boolean and advances the reader index.
      */
     boolean readBoolean();
@@ -151,6 +187,12 @@ public interface Buffer {
     Buffer writeBytes(byte[] src);
 
     /**
+     * Transfers the specified source byte data to this buffer starting at the 
current writer index
+     * and advances the index.
+     */
+    Buffer writeBytes(ByteBuffer src);
+
+    /**
      * Transfers the specified source array's data to this buffer starting at 
the current writer index
      * and advances the index.
      */
@@ -171,4 +213,23 @@ public interface Buffer {
      * Returns the reference count of this object.
      */
     int referenceCount();
+
+    /**
+     * Exposes this buffer's readable bytes as an NIO ByteBuffer's.
+     */
+    ByteBuffer[] nioBuffers();
+
+    /**
+     * Exposes this buffer's readable bytes as a NIO {@link ByteBuffer}. The 
returned buffer
+     * either share or contains the copied content of this buffer, while 
changing the position
+     * and limit of the returned NIO buffer does not affect the indexes and 
marks of this buffer.
+     */
+    ByteBuffer nioBuffer();
+
+    /**
+     * Transfers this buffer's data to the specified destination starting at
+     * the specified absolute {@code index}.
+     * This method does not modify reader or writer indexes.
+     */
+    Buffer getBytes(int index, byte[] dst);
 }
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/BufferFactory.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/BufferFactory.java
new file mode 100644
index 0000000..9b817a8
--- /dev/null
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/BufferFactory.java
@@ -0,0 +1,39 @@
+/*
+ * 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.tinkerpop.gremlin.structure.io;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Represents a factory to create {@link Buffer} instances from {@link T} 
instances.
+ */
+public interface BufferFactory<T> {
+
+    /**
+     * Creates a new {@link Buffer} given a {@link T} instance.
+     * @param value
+     * @return
+     */
+    Buffer create(T value);
+
+    /**
+     * Wraps a NIO buffer.
+     */
+    Buffer wrap(ByteBuffer value);
+}
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/NettyBuffer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/NettyBuffer.java
index 40162c0..0a8ea61 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/NettyBuffer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/NettyBuffer.java
@@ -1,3 +1,21 @@
+/*
+ * 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.tinkerpop.gremlin.driver;
 
 import io.netty.buffer.ByteBuf;
@@ -7,6 +25,9 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
 
+/**
+ * Represents a {@link Buffer} backed by Netty's {@link ByteBuf}.
+ */
 final class NettyBuffer implements Buffer {
     private final ByteBuf buffer;
 
@@ -23,6 +44,11 @@ final class NettyBuffer implements Buffer {
     }
 
     @Override
+    public int readableBytes() {
+        return this.buffer.readableBytes();
+    }
+
+    @Override
     public int readerIndex() {
         return this.buffer.readerIndex();
     }
@@ -45,11 +71,28 @@ final class NettyBuffer implements Buffer {
     }
 
     @Override
+    public Buffer markWriterIndex() {
+        this.buffer.markWriterIndex();
+        return this;
+    }
+
+    @Override
+    public Buffer resetWriterIndex() {
+        this.buffer.resetWriterIndex();
+        return this;
+    }
+
+    @Override
     public int capacity() {
         return this.buffer.capacity();
     }
 
     @Override
+    public boolean isDirect() {
+        return this.buffer.isDirect();
+    }
+
+    @Override
     public boolean readBoolean() {
         return this.buffer.readBoolean();
     }
@@ -157,6 +200,12 @@ final class NettyBuffer implements Buffer {
     }
 
     @Override
+    public Buffer writeBytes(ByteBuffer src) {
+        this.buffer.writeBytes(src);
+        return this;
+    }
+
+    @Override
     public Buffer writeBytes(byte[] src, int srcIndex, int length) {
         this.buffer.writeBytes(src, srcIndex, length);
         return this;
@@ -177,4 +226,20 @@ final class NettyBuffer implements Buffer {
     public int referenceCount() {
         return this.buffer.refCnt();
     }
+
+    @Override
+    public ByteBuffer[] nioBuffers() {
+        return this.buffer.nioBuffers();
+    }
+
+    @Override
+    public ByteBuffer nioBuffer() {
+        return this.buffer.nioBuffer();
+    }
+
+    @Override
+    public Buffer getBytes(int index, byte[] dst) {
+        this.buffer.getBytes(index, dst);
+        return this;
+    }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/UUIDSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/NettyBufferFactory.java
similarity index 52%
copy from 
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/UUIDSerializer.java
copy to 
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/NettyBufferFactory.java
index 5454f53..731d3fe 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/UUIDSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/NettyBufferFactory.java
@@ -16,27 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
+package org.apache.tinkerpop.gremlin.driver;
 
 import io.netty.buffer.ByteBuf;
-import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
-import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
-import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import io.netty.buffer.Unpooled;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
+import org.apache.tinkerpop.gremlin.structure.io.BufferFactory;
 
-import java.util.UUID;
-
-public class UUIDSerializer extends SimpleTypeSerializer<UUID> {
-    public UUIDSerializer() {
-        super(DataType.UUID);
-    }
+import java.nio.ByteBuffer;
 
+/**
+ * Represents a factory to create {@link Buffer} instances from wrapped {@link 
ByteBuf} instances.
+ */
+public class NettyBufferFactory implements BufferFactory<ByteBuf> {
     @Override
-    protected UUID readValue(final ByteBuf buffer, final GraphBinaryReader 
context) {
-        return new UUID(buffer.readLong(), buffer.readLong());
+    public Buffer create(ByteBuf value) {
+        return new NettyBuffer(value);
     }
 
     @Override
-    protected void writeValue(final UUID value, final ByteBuf buffer, final 
GraphBinaryWriter context) {
-        
buffer.writeLong(value.getMostSignificantBits()).writeLong(value.getLeastSignificantBits());
+    public Buffer wrap(ByteBuffer value) {
+        return create(Unpooled.wrappedBuffer(value));
     }
-}
\ No newline at end of file
+}
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryReader.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryReader.java
index e88c752..1052d43 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryReader.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryReader.java
@@ -18,16 +18,16 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 /**
  * Reads a value from a buffer using the {@link TypeSerializer} instances 
configured in the
  * {@link TypeSerializerRegistry}.
  *
  * <p>
- *     This class exposes two different methods to read a value from a buffer: 
{@link GraphBinaryReader#read(ByteBuf)}
- *     and {@link GraphBinaryReader#readValue(ByteBuf, Class, boolean)}:
+ *     This class exposes two different methods to read a value from a buffer: 
{@link GraphBinaryReader#read(Buffer)}
+ *     and {@link GraphBinaryReader#readValue(Buffer, Class, boolean)}:
  *     <ul>
  *         <li>{@code read()} method expects a value in fully-qualified 
format, composed of
  *         <code>{type_code}{type_info}{value_flag}{value}</code>.</li>
@@ -65,7 +65,7 @@ public class GraphBinaryReader {
      * <p>When the value is not nullable, the reader expects only the 
<code>{value}</code> to be contained in the
      * buffer.</p>
      */
-    public <T> T readValue(final ByteBuf buffer, final Class<T> type, final 
boolean nullable) throws SerializationException {
+    public <T> T readValue(final Buffer buffer, final Class<T> type, final 
boolean nullable) throws SerializationException {
         if (buffer == null) {
             throw new IllegalArgumentException("input cannot be null.");
         } else if (type == null) {
@@ -79,7 +79,7 @@ public class GraphBinaryReader {
     /**
      * Reads the type code, information and value of a given buffer with 
fully-qualified format.
      */
-    public <T> T read(final ByteBuf buffer) throws SerializationException {
+    public <T> T read(final Buffer buffer) throws SerializationException {
         // Fully-qualified format: {type_code}{type_info}{value_flag}{value}
         final DataType type = 
DataType.get(Byte.toUnsignedInt(buffer.readByte()));
 
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryWriter.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryWriter.java
index ac22e05..91d9aec 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryWriter.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryWriter.java
@@ -18,11 +18,10 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary;
 
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import 
org.apache.tinkerpop.gremlin.driver.ser.binary.types.CustomTypeSerializer;
 import 
org.apache.tinkerpop.gremlin.driver.ser.binary.types.TransformSerializer;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 /**
  * Writes a value to a buffer using the {@link TypeSerializer} instances 
configured in the
@@ -30,8 +29,8 @@ import 
org.apache.tinkerpop.gremlin.driver.ser.binary.types.TransformSerializer;
  *
  * <p>
  *     This class exposes two different methods to write a value to a buffer:
- *     {@link GraphBinaryWriter#write(Object, ByteBuf)} and
- *     {@link GraphBinaryWriter#writeValue(Object, ByteBuf, boolean)}:
+ *     {@link GraphBinaryWriter#write(Object, Buffer)} and
+ *     {@link GraphBinaryWriter#writeValue(Object, Buffer, boolean)}:
  *     <ul>
  *         <li>{@code write()} method writes the binary representation of the
  *         <code>{type_code}{type_info}{value_flag}{value}</code> 
components.</li>
@@ -60,7 +59,7 @@ public class GraphBinaryWriter {
     /**
      * Writes a value without including type information.
      */
-    public <T> void writeValue(final T value, final ByteBuf buffer, final 
boolean nullable) throws SerializationException {
+    public <T> void writeValue(final T value, final Buffer buffer, final 
boolean nullable) throws SerializationException {
         if (value == null) {
             if (!nullable) {
                 throw new SerializationException("Unexpected null value when 
nullable is false");
@@ -79,7 +78,7 @@ public class GraphBinaryWriter {
     /**
      * Writes an object in fully-qualified format, containing 
{type_code}{type_info}{value_flag}{value}.
      */
-    public <T> void write(final T value, final ByteBuf buffer) throws 
SerializationException {
+    public <T> void write(final T value, final Buffer buffer) throws 
SerializationException {
         if (value == null) {
             // return Object of type "unspecified object null" with the value 
flag set to null.
             buffer.writeBytes(unspecifiedNullBytes);
@@ -93,7 +92,7 @@ public class GraphBinaryWriter {
             // It's a custom type
             CustomTypeSerializer customTypeSerializer = (CustomTypeSerializer) 
serializer;
 
-            buffer.writeBytes(Unpooled.wrappedBuffer(customTypeCodeBytes));
+            buffer.writeBytes(customTypeCodeBytes);
             writeValue(customTypeSerializer.getTypeName(), buffer, false);
             customTypeSerializer.write(value, buffer, this);
             return;
@@ -117,7 +116,7 @@ public class GraphBinaryWriter {
      * specified.
      * <p>Note that for simple types, the provided information will be 
<code>null</code>.</p>
      */
-    public <T> void writeFullyQualifiedNull(final Class<T> objectClass, 
ByteBuf buffer, final Object information) throws SerializationException {
+    public <T> void writeFullyQualifiedNull(final Class<T> objectClass, Buffer 
buffer, final Object information) throws SerializationException {
         TypeSerializer<T> serializer = registry.getSerializer(objectClass);
         serializer.write(null, buffer, this);
     }
@@ -125,14 +124,14 @@ public class GraphBinaryWriter {
     /**
      * Writes a single byte representing the null value_flag.
      */
-    public void writeValueFlagNull(ByteBuf buffer) {
+    public void writeValueFlagNull(Buffer buffer) {
         buffer.writeByte(VALUE_FLAG_NULL);
     }
 
     /**
      * Writes a single byte with value 0, representing an unset value_flag.
      */
-    public void writeValueFlagNone(ByteBuf buffer) {
+    public void writeValueFlagNone(Buffer buffer) {
         buffer.writeByte(VALUE_FLAG_NONE);
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/RequestMessageSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/RequestMessageSerializer.java
index 42f70cd..06c45ed 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/RequestMessageSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/RequestMessageSerializer.java
@@ -19,15 +19,21 @@
 package org.apache.tinkerpop.gremlin.driver.ser.binary;
 
 import io.netty.buffer.ByteBuf;
+import org.apache.tinkerpop.gremlin.driver.NettyBufferFactory;
 import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.Map;
 import java.util.UUID;
 
 public class RequestMessageSerializer {
+    private static NettyBufferFactory bufferFactory = new NettyBufferFactory();
+
+    public RequestMessage readValue(final ByteBuf byteBuf, final 
GraphBinaryReader context) throws SerializationException {
+        // Wrap netty's buffer
+        final Buffer buffer = bufferFactory.create(byteBuf);
 
-    public RequestMessage readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
         final int version = buffer.readByte() & 0xff;
 
         if (version >>> 7 != 1) {
@@ -48,7 +54,10 @@ public class RequestMessageSerializer {
         return builder.create();
     }
 
-    public void writeValue(final RequestMessage value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    public void writeValue(final RequestMessage value, final ByteBuf byteBuf, 
final GraphBinaryWriter context) throws SerializationException {
+        // Wrap netty's buffer
+        final Buffer buffer = bufferFactory.create(byteBuf);
+
         // Version
         buffer.writeByte(GraphBinaryWriter.VERSION_BYTE);
         // RequestId
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/ResponseMessageSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/ResponseMessageSerializer.java
index 70f2a4f..2c35d17 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/ResponseMessageSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/ResponseMessageSerializer.java
@@ -19,18 +19,23 @@
 package org.apache.tinkerpop.gremlin.driver.ser.binary;
 
 import io.netty.buffer.ByteBuf;
+import org.apache.tinkerpop.gremlin.driver.NettyBufferFactory;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseResult;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseStatus;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.Map;
 import java.util.UUID;
 
 public class ResponseMessageSerializer {
+    private static final NettyBufferFactory bufferFactory = new 
NettyBufferFactory();
 
-    public ResponseMessage readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    public ResponseMessage readValue(final ByteBuf byteBuf, final 
GraphBinaryReader context) throws SerializationException {
+        // Wrap netty's buffer
+        final Buffer buffer = bufferFactory.create(byteBuf);
         final int version = buffer.readByte() & 0xff;
 
         if (version >>> 7 != 1) {
@@ -48,7 +53,10 @@ public class ResponseMessageSerializer {
                 .create();
     }
 
-    public void writeValue(final ResponseMessage value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    public void writeValue(final ResponseMessage value, final ByteBuf byteBuf, 
final GraphBinaryWriter context) throws SerializationException {
+        // Wrap netty's buffer
+        final Buffer buffer = bufferFactory.create(byteBuf);
+
         final ResponseResult result = value.getResult();
         final ResponseStatus status = value.getStatus();
 
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializer.java
index eb886e0..280933a 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializer.java
@@ -18,9 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary;
 
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufAllocator;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 /**
  * Represents a serializer for a given type.
@@ -35,7 +34,7 @@ public interface TypeSerializer<T> {
     /**
      * Reads the type information and value from the buffer and returns an 
instance of T.
      */
-    T read(final ByteBuf buffer, final GraphBinaryReader context) throws 
SerializationException;
+    T read(final Buffer buffer, final GraphBinaryReader context) throws 
SerializationException;
 
     /**
      * Reads the value from the buffer (not the type information) and returns 
an instance of T.
@@ -44,15 +43,15 @@ public interface TypeSerializer<T> {
      *     information.
      * </p>
      */
-    T readValue(final ByteBuf buffer, final GraphBinaryReader context, final 
boolean nullable) throws SerializationException;
+    T readValue(final Buffer buffer, final GraphBinaryReader context, final 
boolean nullable) throws SerializationException;
 
     /**
      * Writes the type code, information and value to a buffer using the 
provided allocator.
      */
-    void write(final T value, final ByteBuf buffer, final GraphBinaryWriter 
context) throws SerializationException;
+    void write(final T value, final Buffer buffer, final GraphBinaryWriter 
context) throws SerializationException;
 
     /**
      * Writes the value to a buffer, composed by the value flag and the 
sequence of bytes.
      */
-    void writeValue(final T value, final ByteBuf buffer, final 
GraphBinaryWriter context, final boolean nullable) throws 
SerializationException;
+    void writeValue(final T value, final Buffer buffer, final 
GraphBinaryWriter context, final boolean nullable) throws 
SerializationException;
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BigDecimalSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BigDecimalSerializer.java
index f38f285..e74dcde 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BigDecimalSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BigDecimalSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -36,14 +36,14 @@ public class BigDecimalSerializer extends 
SimpleTypeSerializer<BigDecimal> {
     }
 
     @Override
-    protected BigDecimal readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected BigDecimal readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final int scale = context.readValue(buffer, Integer.class, false);
         final BigInteger unscaled = context.readValue(buffer, 
BigInteger.class, false);
         return new BigDecimal(unscaled, scale);
     }
 
     @Override
-    protected void writeValue(final BigDecimal value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final BigDecimal value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.scale(), buffer, false);
         context.writeValue(value.unscaledValue(), buffer, false);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BigIntegerSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BigIntegerSerializer.java
index de32564..435b5a6 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BigIntegerSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BigIntegerSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.math.BigInteger;
 
@@ -36,14 +36,14 @@ public class BigIntegerSerializer extends 
SimpleTypeSerializer<BigInteger> {
     }
 
     @Override
-    protected BigInteger readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected BigInteger readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final byte[] bigIntBytes = new byte[buffer.readInt()];
         buffer.readBytes(bigIntBytes);
         return new BigInteger(bigIntBytes);
     }
 
     @Override
-    protected void writeValue(final BigInteger value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final BigInteger value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         final byte[] twosComplement = value.toByteArray();
         buffer.writeInt(twosComplement.length).writeBytes(twosComplement);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BindingSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BindingSerializer.java
index b1bb9d1..1aa3bf6 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BindingSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BindingSerializer.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -35,13 +35,13 @@ public class BindingSerializer extends 
SimpleTypeSerializer<Bytecode.Binding> {
     }
 
     @Override
-    protected Bytecode.Binding readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected Bytecode.Binding readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final String k = context.readValue(buffer, String.class, false);
         return new Bytecode.Binding<>(k, context.read(buffer));
     }
 
     @Override
-    protected void writeValue(final Bytecode.Binding value, final ByteBuf 
buffer, final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Bytecode.Binding value, final Buffer 
buffer, final GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.variable(), buffer, false);
         context.write(value.value(), buffer);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BulkSetSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BulkSetSerializer.java
index 98be768..db5eef9 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BulkSetSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/BulkSetSerializer.java
@@ -18,13 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.CompositeByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.Map;
 
@@ -37,7 +36,7 @@ public class BulkSetSerializer extends 
SimpleTypeSerializer<BulkSet> {
     }
 
     @Override
-    protected BulkSet readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected BulkSet readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final int length = buffer.readInt();
 
         final BulkSet result = new BulkSet();
@@ -49,7 +48,7 @@ public class BulkSetSerializer extends 
SimpleTypeSerializer<BulkSet> {
     }
 
     @Override
-    protected void writeValue(final BulkSet value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final BulkSet value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         final Map<Object,Long> raw = value.asBulk();
         buffer.writeInt(raw.size());
 
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ByteBufferSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ByteBufferSerializer.java
index 55106dd..4d2c162 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ByteBufferSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ByteBufferSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.nio.ByteBuffer;
 
@@ -36,7 +36,7 @@ public class ByteBufferSerializer extends 
SimpleTypeSerializer<ByteBuffer> {
     }
 
     @Override
-    protected ByteBuffer readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected ByteBuffer readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final ByteBuffer bb = ByteBuffer.allocate(buffer.readInt());
         buffer.readBytes(bb);
         bb.rewind();
@@ -44,7 +44,7 @@ public class ByteBufferSerializer extends 
SimpleTypeSerializer<ByteBuffer> {
     }
 
     @Override
-    protected void writeValue(final ByteBuffer value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final ByteBuffer value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         final byte[] bytes = value.array();
         buffer.writeInt(bytes.length).writeBytes(bytes);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ByteCodeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ByteCodeSerializer.java
index 3ba6276..4e34a9b 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ByteCodeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ByteCodeSerializer.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.List;
 
@@ -33,7 +33,7 @@ public class ByteCodeSerializer extends 
SimpleTypeSerializer<Bytecode> {
     }
 
     @Override
-    protected Bytecode readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Bytecode readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final Bytecode result = new Bytecode();
 
         final int stepsLength = buffer.readInt();
@@ -49,7 +49,7 @@ public class ByteCodeSerializer extends 
SimpleTypeSerializer<Bytecode> {
         return result;
     }
 
-    private static Object[] getInstructionArguments(final ByteBuf buffer, 
final GraphBinaryReader context) throws SerializationException {
+    private static Object[] getInstructionArguments(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final int valuesLength = buffer.readInt();
         final Object[] values = new Object[valuesLength];
         for (int j = 0; j < valuesLength; j++) {
@@ -59,7 +59,7 @@ public class ByteCodeSerializer extends 
SimpleTypeSerializer<Bytecode> {
     }
 
     @Override
-    protected void writeValue(final Bytecode value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Bytecode value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         final List<Bytecode.Instruction> steps = value.getStepInstructions();
         final List<Bytecode.Instruction> sources = 
value.getSourceInstructions();
         // 2 buffers for the length + plus 2 buffers per each step and source
@@ -68,7 +68,7 @@ public class ByteCodeSerializer extends 
SimpleTypeSerializer<Bytecode> {
         writeInstructions(buffer, context, sources);
     }
 
-    private void writeInstructions(final ByteBuf buffer, final 
GraphBinaryWriter context,
+    private void writeInstructions(final Buffer buffer, final 
GraphBinaryWriter context,
                                    final List<Bytecode.Instruction> 
instructions) throws SerializationException {
 
         context.writeValue(instructions.size(), buffer, false);
@@ -79,7 +79,7 @@ public class ByteCodeSerializer extends 
SimpleTypeSerializer<Bytecode> {
         }
     }
 
-    private static void fillArgumentsBuffer(final Object[] arguments, final 
ByteBuf buffer, final GraphBinaryWriter context) throws SerializationException {
+    private static void fillArgumentsBuffer(final Object[] arguments, final 
Buffer buffer, final GraphBinaryWriter context) throws SerializationException {
 
         context.writeValue(arguments.length, buffer, false);
 
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CharSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CharSerializer.java
index f4e4abc..6a06fcb 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CharSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CharSerializer.java
@@ -18,12 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.nio.charset.StandardCharsets;
 
@@ -33,7 +32,7 @@ public class CharSerializer extends 
SimpleTypeSerializer<Character> {
     }
 
     @Override
-    protected Character readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected Character readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final int firstByte = buffer.readByte() & 0xff;
         int byteLength = 1;
         // A byte with the first byte ON (10000000) signals that more bytes 
are needed to represent the UTF-8 char
@@ -60,7 +59,7 @@ public class CharSerializer extends 
SimpleTypeSerializer<Character> {
     }
 
     @Override
-    protected void writeValue(final Character value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Character value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         final String stringValue = Character.toString(value);
         buffer.writeBytes(stringValue.getBytes(StandardCharsets.UTF_8));
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ClassSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ClassSerializer.java
index 9e03696..1e0a8a5 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ClassSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ClassSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 public class ClassSerializer extends SimpleTypeSerializer<Class> {
     public ClassSerializer() {
@@ -30,7 +30,7 @@ public class ClassSerializer extends 
SimpleTypeSerializer<Class> {
     }
 
     @Override
-    protected Class readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Class readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final String name = context.readValue(buffer, String.class, false);
         try {
             return Class.forName(name);
@@ -40,7 +40,7 @@ public class ClassSerializer extends 
SimpleTypeSerializer<Class> {
     }
 
     @Override
-    protected void writeValue(final Class value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Class value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.getName(), buffer, false);
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CollectionSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CollectionSerializer.java
index 0a303c8..a951bbf 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CollectionSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CollectionSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -33,7 +33,7 @@ class CollectionSerializer extends 
SimpleTypeSerializer<Collection> {
     }
 
     @Override
-    protected Collection readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected Collection readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final int length = buffer.readInt();
 
         final ArrayList result = new ArrayList(length);
@@ -45,7 +45,7 @@ class CollectionSerializer extends 
SimpleTypeSerializer<Collection> {
     }
 
     @Override
-    protected void writeValue(final Collection value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Collection value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         buffer.writeInt(value.size());
 
         for (Object item : value) {
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/DateSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/DateSerializer.java
index ae29ba4..f999591 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/DateSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/DateSerializer.java
@@ -18,10 +18,10 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.sql.Timestamp;
 import java.util.Date;
@@ -43,12 +43,12 @@ public class DateSerializer<T extends Date> extends 
SimpleTypeSerializer<T> {
     }
 
     @Override
-    protected T readValue(final ByteBuf buffer, final GraphBinaryReader 
context) {
+    protected T readValue(final Buffer buffer, final GraphBinaryReader 
context) {
         return reader.apply(buffer.readLong());
     }
 
     @Override
-    protected void writeValue(final T value, final ByteBuf buffer, final 
GraphBinaryWriter context) {
+    protected void writeValue(final T value, final Buffer buffer, final 
GraphBinaryWriter context) {
         buffer.writeLong(value.getTime());
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/DurationSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/DurationSerializer.java
index 46a2d64..7844554 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/DurationSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/DurationSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.Duration;
 
@@ -35,12 +35,12 @@ public class DurationSerializer extends 
SimpleTypeSerializer<Duration> {
     }
 
     @Override
-    protected Duration readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Duration readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         return Duration.ofSeconds(buffer.readLong(), buffer.readInt());
     }
 
     @Override
-    protected void writeValue(final Duration value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Duration value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         buffer.writeLong(value.getSeconds()).writeInt(value.getNano());
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/EdgeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/EdgeSerializer.java
index aeea1a4..9769131 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/EdgeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/EdgeSerializer.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex;
 
@@ -36,7 +36,7 @@ public class EdgeSerializer extends 
SimpleTypeSerializer<Edge> {
     }
 
     @Override
-    protected Edge readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Edge readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final Object id = context.read(buffer);
         final String label = context.readValue(buffer, String.class, false);
 
@@ -57,7 +57,7 @@ public class EdgeSerializer extends 
SimpleTypeSerializer<Edge> {
     }
 
     @Override
-    protected void writeValue(final Edge value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Edge value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
 
         context.write(value.id(), buffer);
         context.writeValue(value.label(), buffer, false);
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/EnumSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/EnumSerializer.java
index 618398b..57f01cc 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/EnumSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/EnumSerializer.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
@@ -33,6 +32,7 @@ import org.apache.tinkerpop.gremlin.structure.Column;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.function.Function;
 
@@ -62,12 +62,12 @@ public class EnumSerializer<E extends Enum> extends 
SimpleTypeSerializer<E> {
     }
 
     @Override
-    protected E readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected E readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         return readFunc.apply(context.read(buffer));
     }
 
     @Override
-    protected void writeValue(final E value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final E value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         context.write(value.name(), buffer);
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/GraphSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/GraphSerializer.java
index c4274f0..ad69869 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/GraphSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/GraphSerializer.java
@@ -18,8 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufAllocator;
 import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
@@ -32,6 +30,7 @@ import org.apache.tinkerpop.gremlin.structure.Property;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
 import java.lang.reflect.Method;
@@ -52,7 +51,7 @@ public class GraphSerializer extends 
SimpleTypeSerializer<Graph> {
     }
 
     @Override
-    protected Graph readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Graph readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
 
         if (null == openMethod)
             throw new SerializationException("TinkerGraph is an optional 
dependency to gremlin-driver - if deserializing Graph instances it must be 
explicitly added as a dependency");
@@ -109,7 +108,7 @@ public class GraphSerializer extends 
SimpleTypeSerializer<Graph> {
     }
 
     @Override
-    protected void writeValue(final Graph value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Graph value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         // this kinda looks scary memory-wise, but GraphBinary is about 
network derser so we are dealing with a
         // graph instance that should live in memory already - not expecting 
"big" stuff here.
         final List<Vertex> vertexList = IteratorUtils.list(value.vertices());
@@ -128,7 +127,7 @@ public class GraphSerializer extends 
SimpleTypeSerializer<Graph> {
         }
     }
 
-    private void writeVertex(ByteBuf buffer, GraphBinaryWriter context, Vertex 
vertex) throws SerializationException {
+    private void writeVertex(Buffer buffer, GraphBinaryWriter context, Vertex 
vertex) throws SerializationException {
         final List<VertexProperty<Object>> vertexProperties = 
IteratorUtils.list(vertex.properties());
 
         context.write(vertex.id(), buffer);
@@ -148,7 +147,7 @@ public class GraphSerializer extends 
SimpleTypeSerializer<Graph> {
         }
     }
 
-    private void writeEdge(ByteBuf buffer, GraphBinaryWriter context, Edge 
edge) throws SerializationException {
+    private void writeEdge(Buffer buffer, GraphBinaryWriter context, Edge 
edge) throws SerializationException {
         context.write(edge.id(), buffer);
         context.writeValue(edge.label(), buffer, false);
 
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/InetAddressSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/InetAddressSerializer.java
index 993ecc1..08de390 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/InetAddressSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/InetAddressSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -36,7 +36,7 @@ public class InetAddressSerializer<T extends InetAddress> 
extends SimpleTypeSeri
     }
 
     @Override
-    protected T readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected T readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final int length = buffer.readInt();
         final byte[] bytes = new byte[length];
         buffer.readBytes(bytes);
@@ -49,7 +49,7 @@ public class InetAddressSerializer<T extends InetAddress> 
extends SimpleTypeSeri
     }
 
     @Override
-    protected void writeValue(final T value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final T value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         final byte[] bytes = value.getAddress();
         buffer.writeInt(bytes.length).writeBytes(bytes);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/InstantSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/InstantSerializer.java
index 760d568..62bcbfc 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/InstantSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/InstantSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.Instant;
 
@@ -35,12 +35,12 @@ public class InstantSerializer extends 
SimpleTypeSerializer<Instant> {
     }
 
     @Override
-    protected Instant readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Instant readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         return Instant.ofEpochSecond(buffer.readLong(), buffer.readInt());
     }
 
     @Override
-    protected void writeValue(final Instant value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Instant value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         buffer.writeLong(value.getEpochSecond()).writeInt(value.getNano());
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LambdaSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LambdaSerializer.java
index dfe11c8..f72e478 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LambdaSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LambdaSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
 
 /**
@@ -34,7 +34,7 @@ public class LambdaSerializer extends 
SimpleTypeSerializer<Lambda> {
     }
 
     @Override
-    protected Lambda readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Lambda readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final String lang = context.readValue(buffer, String.class, false);
         final String script = context.readValue(buffer, String.class, false);
         final int args = context.readValue(buffer, Integer.class, false);
@@ -50,7 +50,7 @@ public class LambdaSerializer extends 
SimpleTypeSerializer<Lambda> {
     }
 
     @Override
-    protected void writeValue(final Lambda value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Lambda value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.getLambdaLanguage(), buffer, false);
         context.writeValue(value.getLambdaScript(), buffer, false);
         context.writeValue(value.getLambdaArguments(), buffer, false);
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ListSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ListSerializer.java
index 67e1a53..49e5061 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ListSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ListSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.List;
 
@@ -34,13 +34,13 @@ public class ListSerializer extends 
SimpleTypeSerializer<List> {
     }
 
     @Override
-    protected List readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected List readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         // The collection is a List<>
         return (List) collectionSerializer.readValue(buffer, context);
     }
 
     @Override
-    protected void writeValue(final List value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final List value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         collectionSerializer.writeValue(value, buffer, context);
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalDateSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalDateSerializer.java
index 6a3c29c..560d98b 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalDateSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalDateSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.LocalDate;
 
@@ -35,12 +35,12 @@ public class LocalDateSerializer extends 
SimpleTypeSerializer<LocalDate> {
     }
 
     @Override
-    protected LocalDate readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected LocalDate readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         return LocalDate.of(buffer.readInt(), buffer.readByte(), 
buffer.readByte());
     }
 
     @Override
-    protected void writeValue(final LocalDate value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final LocalDate value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         
buffer.writeInt(value.getYear()).writeByte(value.getMonthValue()).writeByte(value.getDayOfMonth());
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalDateTimeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalDateTimeSerializer.java
index 244bf2c..8971cc6 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalDateTimeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalDateTimeSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -37,13 +37,13 @@ public class LocalDateTimeSerializer extends 
SimpleTypeSerializer<LocalDateTime>
     }
 
     @Override
-    protected LocalDateTime readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected LocalDateTime readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         return LocalDateTime.of(context.readValue(buffer, LocalDate.class, 
false),
                 context.readValue(buffer, LocalTime.class, false));
     }
 
     @Override
-    protected void writeValue(final LocalDateTime value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final LocalDateTime value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.toLocalDate(), buffer, false);
         context.writeValue(value.toLocalTime(), buffer, false);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalTimeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalTimeSerializer.java
index 95e19c2..e2639ce 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalTimeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/LocalTimeSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.LocalTime;
 
@@ -35,12 +35,12 @@ public class LocalTimeSerializer extends 
SimpleTypeSerializer<LocalTime> {
     }
 
     @Override
-    protected LocalTime readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected LocalTime readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         return LocalTime.ofNanoOfDay(buffer.readLong());
     }
 
     @Override
-    protected void writeValue(final LocalTime value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final LocalTime value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         buffer.writeLong(value.toNanoOfDay());
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MapEntrySerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MapEntrySerializer.java
index 9f3e56c..e521371 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MapEntrySerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MapEntrySerializer.java
@@ -18,10 +18,10 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -32,12 +32,12 @@ public class MapEntrySerializer extends 
SimpleTypeSerializer<Map.Entry> implemen
     }
 
     @Override
-    protected Map.Entry readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected Map.Entry readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         throw new SerializationException("A map entry should not be read 
individually");
     }
 
     @Override
-    protected void writeValue(final Map.Entry value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Map.Entry value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         throw new SerializationException("A map entry should not be written 
individually");
     }
 
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MapSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MapSerializer.java
index e25a7cf..9ece182 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MapSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MapSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -34,7 +34,7 @@ public class MapSerializer extends SimpleTypeSerializer<Map> {
     }
 
     @Override
-    protected Map readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Map readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final int length = buffer.readInt();
 
         final Map<Object,Object> result = new LinkedHashMap<>(length);
@@ -46,7 +46,7 @@ public class MapSerializer extends SimpleTypeSerializer<Map> {
     }
 
     @Override
-    protected void writeValue(final Map value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Map value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         buffer.writeInt(value.size());
 
         for (Map.Entry entry : (Set<Map.Entry>) value.entrySet()) {
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MetricsSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MetricsSerializer.java
index 03e59f3..5734c48 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MetricsSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MetricsSerializer.java
@@ -18,13 +18,13 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.util.Metrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.Collection;
 import java.util.Map;
@@ -38,7 +38,7 @@ public class MetricsSerializer extends 
SimpleTypeSerializer<Metrics> {
     }
 
     @Override
-    protected Metrics readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Metrics readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         // Consider using a custom implementation, like "DefaultMetrics"
         final MutableMetrics result = new MutableMetrics(
                 context.readValue(buffer, String.class, false),
@@ -54,7 +54,7 @@ public class MetricsSerializer extends 
SimpleTypeSerializer<Metrics> {
     }
 
     @Override
-    protected void writeValue(final Metrics value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Metrics value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.getId(), buffer, false);
         context.writeValue(value.getName(), buffer, false);
         context.writeValue(value.getDuration(TimeUnit.NANOSECONDS), buffer, 
false);
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MonthDaySerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MonthDaySerializer.java
index 48f4ac4..046b0f2 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MonthDaySerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/MonthDaySerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.MonthDay;
 
@@ -35,12 +35,12 @@ public class MonthDaySerializer extends 
SimpleTypeSerializer<MonthDay> {
     }
 
     @Override
-    protected MonthDay readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected MonthDay readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         return MonthDay.of(buffer.readByte(), buffer.readByte());
     }
 
     @Override
-    protected void writeValue(final MonthDay value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final MonthDay value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         
buffer.writeByte(value.getMonthValue()).writeByte(value.getDayOfMonth());
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/OffsetDateTimeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/OffsetDateTimeSerializer.java
index c300344..7e09082 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/OffsetDateTimeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/OffsetDateTimeSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.LocalDateTime;
 import java.time.OffsetDateTime;
@@ -37,14 +37,14 @@ public class OffsetDateTimeSerializer extends 
SimpleTypeSerializer<OffsetDateTim
     }
 
     @Override
-    protected OffsetDateTime readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected OffsetDateTime readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final LocalDateTime ldt = context.readValue(buffer, 
LocalDateTime.class, false);
         final ZoneOffset zo = context.readValue(buffer, ZoneOffset.class, 
false);
         return OffsetDateTime.of(ldt, zo);
     }
 
     @Override
-    protected void writeValue(final OffsetDateTime value, final ByteBuf 
buffer, final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final OffsetDateTime value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.toLocalDateTime(), buffer, false);
         context.writeValue(value.getOffset(), buffer, false);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/OffsetTimeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/OffsetTimeSerializer.java
index e9f4cc4..052ecfb 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/OffsetTimeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/OffsetTimeSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.LocalTime;
 import java.time.OffsetTime;
@@ -37,14 +37,14 @@ public class OffsetTimeSerializer extends 
SimpleTypeSerializer<OffsetTime> {
     }
 
     @Override
-    protected OffsetTime readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected OffsetTime readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final LocalTime ldt = context.readValue(buffer, LocalTime.class, 
false);
         final ZoneOffset zo = context.readValue(buffer, ZoneOffset.class, 
false);
         return OffsetTime.of(ldt, zo);
     }
 
     @Override
-    protected void writeValue(final OffsetTime value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final OffsetTime value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.toLocalTime(), buffer, false);
         context.writeValue(value.getOffset(), buffer, false);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PSerializer.java
index be399f0..fc092cf 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PSerializer.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
@@ -26,6 +25,7 @@ import 
org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.util.AndP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -53,7 +53,7 @@ public class PSerializer<T extends P> extends 
SimpleTypeSerializer<T> {
     }
 
     @Override
-    protected T readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected T readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final String predicateName = context.readValue(buffer, String.class, 
false);
         final int length = context.readValue(buffer, Integer.class, false);
         final Object[] args = new Object[length];
@@ -149,7 +149,7 @@ public class PSerializer<T extends P> extends 
SimpleTypeSerializer<T> {
     }
 
     @Override
-    protected void writeValue(final T value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final T value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         // the predicate name is either a static method of P or an instance 
method when a type ConnectiveP
         final boolean isConnectedP = value instanceof ConnectiveP;
         final String predicateName = isConnectedP ?
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PathSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PathSerializer.java
index 93eb1cc..bdc6fe2 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PathSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PathSerializer.java
@@ -18,13 +18,13 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.MutablePath;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
 
 import java.util.List;
@@ -40,7 +40,7 @@ public class PathSerializer extends 
SimpleTypeSerializer<Path> {
     }
 
     @Override
-    protected Path readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Path readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final MutablePath path = (MutablePath) MutablePath.make();
         final List<Set<String>> labels = context.read(buffer);
         final List<Object> objects = context.read(buffer);
@@ -56,7 +56,7 @@ public class PathSerializer extends 
SimpleTypeSerializer<Path> {
     }
 
     @Override
-    protected void writeValue(final Path value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Path value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         context.write(value.labels(), buffer);
         context.write(value.objects(), buffer);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PeriodSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PeriodSerializer.java
index 4d4f3d1..1f58c09 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PeriodSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PeriodSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.Period;
 
@@ -35,12 +35,12 @@ public class PeriodSerializer extends 
SimpleTypeSerializer<Period> {
     }
 
     @Override
-    protected Period readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Period readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         return Period.of(buffer.readInt(), buffer.readInt(), buffer.readInt());
     }
 
     @Override
-    protected void writeValue(final Period value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Period value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         
buffer.writeInt(value.getYears()).writeInt(value.getMonths()).writeInt(value.getDays());
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PropertySerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PropertySerializer.java
index 8c7d07c..7092ff8 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PropertySerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/PropertySerializer.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceProperty;
 
 /**
@@ -36,7 +36,7 @@ public class PropertySerializer extends 
SimpleTypeSerializer<Property> {
     }
 
     @Override
-    protected Property readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Property readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final Property p = new ReferenceProperty<>(context.readValue(buffer, 
String.class, false), context.read(buffer));
 
         // discard the parent element as it's not serialized for references 
right now
@@ -45,7 +45,7 @@ public class PropertySerializer extends 
SimpleTypeSerializer<Property> {
     }
 
     @Override
-    protected void writeValue(final Property value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Property value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.key(), buffer, false);
         context.write(value.value(), buffer);
 
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SetSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SetSerializer.java
index 21f254a..1f7e6cd 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SetSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SetSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -35,12 +35,12 @@ public class SetSerializer extends 
SimpleTypeSerializer<Set>{
     }
 
     @Override
-    protected Set readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Set readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         return new HashSet<>(collectionSerializer.readValue(buffer, context));
     }
 
     @Override
-    protected void writeValue(final Set value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Set value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         collectionSerializer.writeValue(value, buffer, context);
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SimpleTypeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SimpleTypeSerializer.java
index 65e6503..053b1b9 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SimpleTypeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SimpleTypeSerializer.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.TypeSerializer;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 /**
  * Base class for serialization of types that don't contain type specific 
information only {type_code}, {value_flag}
@@ -41,13 +41,13 @@ public abstract class SimpleTypeSerializer<T> implements 
TypeSerializer<T> {
     }
 
     @Override
-    public T read(final ByteBuf buffer, final GraphBinaryReader context) 
throws SerializationException {
+    public T read(final Buffer buffer, final GraphBinaryReader context) throws 
SerializationException {
         // No {type_info}, just {value_flag}{value}
         return readValue(buffer, context, true);
     }
 
     @Override
-    public T readValue(final ByteBuf buffer, final GraphBinaryReader context, 
final boolean nullable) throws SerializationException {
+    public T readValue(final Buffer buffer, final GraphBinaryReader context, 
final boolean nullable) throws SerializationException {
         if (nullable) {
             final byte valueFlag = buffer.readByte();
             if ((valueFlag & 1) == 1) {
@@ -65,15 +65,15 @@ public abstract class SimpleTypeSerializer<T> implements 
TypeSerializer<T> {
      * @return
      * @throws SerializationException
      */
-    protected abstract T readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException;
+    protected abstract T readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException;
 
     @Override
-    public void write(final T value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    public void write(final T value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         writeValue(value, buffer, context, true);
     }
 
     @Override
-    public void writeValue(final T value, final ByteBuf buffer, final 
GraphBinaryWriter context, final boolean nullable) throws 
SerializationException {
+    public void writeValue(final T value, final Buffer buffer, final 
GraphBinaryWriter context, final boolean nullable) throws 
SerializationException {
         if (value == null) {
             if (!nullable) {
                 throw new SerializationException("Unexpected null value when 
nullable is false");
@@ -97,5 +97,5 @@ public abstract class SimpleTypeSerializer<T> implements 
TypeSerializer<T> {
      * @param context The binary writer.
      * @throws SerializationException
      */
-    protected abstract void writeValue(final T value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException;
+    protected abstract void writeValue(final T value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException;
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SingleTypeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SingleTypeSerializer.java
index e722a24..13223f7 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SingleTypeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/SingleTypeSerializer.java
@@ -18,10 +18,10 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.Year;
 import java.util.function.BiConsumer;
@@ -33,39 +33,39 @@ import java.util.function.Function;
  */
 public class SingleTypeSerializer<T> extends SimpleTypeSerializer<T> {
     public static final SingleTypeSerializer<Integer> IntSerializer =
-            new SingleTypeSerializer<>(DataType.INT, ByteBuf::readInt, (v, b) 
-> b.writeInt(v));
+            new SingleTypeSerializer<>(DataType.INT, Buffer::readInt, (v, b) 
-> b.writeInt(v));
     public static final SingleTypeSerializer<Long> LongSerializer =
-            new SingleTypeSerializer<>(DataType.LONG, ByteBuf::readLong, (v, 
b) -> b.writeLong(v));
+            new SingleTypeSerializer<>(DataType.LONG, Buffer::readLong, (v, b) 
-> b.writeLong(v));
     public static final SingleTypeSerializer<Double> DoubleSerializer =
-            new SingleTypeSerializer<>(DataType.DOUBLE, ByteBuf::readDouble, 
(v, b) -> b.writeDouble(v));
+            new SingleTypeSerializer<>(DataType.DOUBLE, Buffer::readDouble, 
(v, b) -> b.writeDouble(v));
     public static final SingleTypeSerializer<Float> FloatSerializer =
-            new SingleTypeSerializer<>(DataType.FLOAT, ByteBuf::readFloat, (v, 
b) -> b.writeFloat(v));
+            new SingleTypeSerializer<>(DataType.FLOAT, Buffer::readFloat, (v, 
b) -> b.writeFloat(v));
     public static final SingleTypeSerializer<Short> ShortSerializer =
-            new SingleTypeSerializer<>(DataType.SHORT, ByteBuf::readShort, (v, 
b) -> b.writeShort(v));
+            new SingleTypeSerializer<>(DataType.SHORT, Buffer::readShort, (v, 
b) -> b.writeShort(v));
     public static final SingleTypeSerializer<Boolean> BooleanSerializer =
-            new SingleTypeSerializer<>(DataType.BOOLEAN, ByteBuf::readBoolean, 
(v, b) -> b.writeBoolean(v));
+            new SingleTypeSerializer<>(DataType.BOOLEAN, Buffer::readBoolean, 
(v, b) -> b.writeBoolean(v));
     public static final SingleTypeSerializer<Byte> ByteSerializer =
-            new SingleTypeSerializer<>(DataType.BYTE, ByteBuf::readByte, (v, 
b) -> b.writeByte(v));
+            new SingleTypeSerializer<>(DataType.BYTE, Buffer::readByte, (v, b) 
-> b.writeByte(v));
     public static final SingleTypeSerializer<Year> YearSerializer =
             new SingleTypeSerializer<>(DataType.YEAR, bb -> 
Year.of(bb.readInt()), (v, b) -> b.writeInt(v.getValue()));
 
-    private final Function<ByteBuf, T> readFunc;
-    private final BiConsumer<T, ByteBuf> writeFunc;
+    private final Function<Buffer, T> readFunc;
+    private final BiConsumer<T, Buffer> writeFunc;
 
-    private SingleTypeSerializer(final DataType dataType, final 
Function<ByteBuf, T> readFunc,
-                                 final BiConsumer<T, ByteBuf> writeFunc) {
+    private SingleTypeSerializer(final DataType dataType, final 
Function<Buffer, T> readFunc,
+                                 final BiConsumer<T, Buffer> writeFunc) {
         super(dataType);
         this.readFunc = readFunc;
         this.writeFunc = writeFunc;
     }
 
     @Override
-    public T readValue(final ByteBuf buffer, final GraphBinaryReader context) {
+    public T readValue(final Buffer buffer, final GraphBinaryReader context) {
         return readFunc.apply(buffer);
     }
 
     @Override
-    protected void writeValue(final T value, final ByteBuf buffer, final 
GraphBinaryWriter context) {
+    protected void writeValue(final T value, final Buffer buffer, final 
GraphBinaryWriter context) {
         writeFunc.accept(value, buffer);
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/StringSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/StringSerializer.java
index c21d6d3..f5a1f7e 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/StringSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/StringSerializer.java
@@ -18,10 +18,10 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.nio.charset.StandardCharsets;
 
@@ -31,7 +31,7 @@ public class StringSerializer extends 
SimpleTypeSerializer<String> {
     }
 
     @Override
-    protected String readValue(final ByteBuf buffer, final GraphBinaryReader 
context) {
+    protected String readValue(final Buffer buffer, final GraphBinaryReader 
context) {
         // Use Netty 4.0 API (avoid ByteBuf#readCharSequence() method) to 
maximize compatibility
         final byte[] bytes = new byte[buffer.readInt()];
         buffer.readBytes(bytes);
@@ -39,7 +39,7 @@ public class StringSerializer extends 
SimpleTypeSerializer<String> {
     }
 
     @Override
-    protected void writeValue(final String value, final ByteBuf buffer, final 
GraphBinaryWriter context) {
+    protected void writeValue(final String value, final Buffer buffer, final 
GraphBinaryWriter context) {
         final byte[] stringBytes = value.getBytes(StandardCharsets.UTF_8);
         buffer.writeInt(stringBytes.length).writeBytes(stringBytes);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalExplanationSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalExplanationSerializer.java
index a8ef5b3..0b8d4c7 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalExplanationSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalExplanationSerializer.java
@@ -18,13 +18,13 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import 
org.apache.tinkerpop.gremlin.process.traversal.util.TraversalExplanation;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.javatuples.Pair;
 
 import java.util.HashMap;
@@ -45,12 +45,12 @@ public class TraversalExplanationSerializer extends 
SimpleTypeSerializer<Travers
     }
 
     @Override
-    protected TraversalExplanation readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected TraversalExplanation readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         throw new SerializationException("A TraversalExplanation should not be 
read individually");
     }
 
     @Override
-    protected void writeValue(final TraversalExplanation value, final ByteBuf 
buffer, final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final TraversalExplanation value, final Buffer 
buffer, final GraphBinaryWriter context) throws SerializationException {
         throw new SerializationException("A TraversalExplanation should not be 
written individually");
     }
 
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalMetricsSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalMetricsSerializer.java
index e21512f..8f0e9cc 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalMetricsSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalMetricsSerializer.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
@@ -26,6 +25,7 @@ import 
org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import 
org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -39,14 +39,14 @@ public class TraversalMetricsSerializer extends 
SimpleTypeSerializer<TraversalMe
     }
 
     @Override
-    protected TraversalMetrics readValue(ByteBuf buffer, GraphBinaryReader 
context) throws SerializationException {
+    protected TraversalMetrics readValue(Buffer buffer, GraphBinaryReader 
context) throws SerializationException {
         Long durationNanos = context.readValue(buffer, Long.class, false);
         final List<MutableMetrics> metrics = new 
ArrayList<>(collectionSerializer.readValue(buffer, context));
         return new DefaultTraversalMetrics(durationNanos, metrics);
     }
 
     @Override
-    protected void writeValue(TraversalMetrics value, ByteBuf buffer, 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(TraversalMetrics value, Buffer buffer, 
GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.getDuration(TimeUnit.NANOSECONDS), buffer, 
false);
         collectionSerializer.writeValue(value.getMetrics(), buffer, context);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalStrategySerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalStrategySerializer.java
index e740443..006a2e3 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalStrategySerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraversalStrategySerializer.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.commons.configuration.ConfigurationConverter;
 import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
@@ -28,6 +27,7 @@ import 
org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import 
org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -42,7 +42,7 @@ public class TraversalStrategySerializer extends 
SimpleTypeSerializer<TraversalS
     }
 
     @Override
-    protected TraversalStrategy readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected TraversalStrategy readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final Class<TraversalStrategy> clazz = context.readValue(buffer, 
Class.class, false);
         final Map config = context.readValue(buffer, Map.class, false);
 
@@ -50,7 +50,7 @@ public class TraversalStrategySerializer extends 
SimpleTypeSerializer<TraversalS
     }
 
     @Override
-    protected void writeValue(final TraversalStrategy value, final ByteBuf 
buffer, final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final TraversalStrategy value, final Buffer 
buffer, final GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.getClass(), buffer, false);
         
context.writeValue(translateToBytecode(ConfigurationConverter.getMap(value.getConfiguration())),
 buffer, false);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraverserSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraverserSerializer.java
index ebd6b8c..4dede70 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraverserSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TraverserSerializer.java
@@ -18,13 +18,13 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import 
org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -36,14 +36,14 @@ public class TraverserSerializer extends 
SimpleTypeSerializer<Traverser> {
     }
 
     @Override
-    protected Traverser readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected Traverser readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final long bulk = context.readValue(buffer, Long.class, false);
         final Object v = context.read(buffer);
         return new DefaultRemoteTraverser<>(v, bulk);
     }
 
     @Override
-    protected void writeValue(final Traverser value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Traverser value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.bulk(), buffer, false);
         context.write(value.get(), buffer);
     }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TreeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TreeSerializer.java
index 76c9d16..3747914 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TreeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/TreeSerializer.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 public class TreeSerializer extends SimpleTypeSerializer<Tree> {
     public TreeSerializer() {
@@ -31,7 +31,7 @@ public class TreeSerializer extends 
SimpleTypeSerializer<Tree> {
     }
 
     @Override
-    protected Tree readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Tree readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final int length = buffer.readInt();
 
         final Tree result = new Tree();
@@ -43,7 +43,7 @@ public class TreeSerializer extends 
SimpleTypeSerializer<Tree> {
     }
 
     @Override
-    protected void writeValue(final Tree value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Tree value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         buffer.writeInt(value.size());
 
         for (Object key : value.keySet()) {
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/UUIDSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/UUIDSerializer.java
index 5454f53..7fd68d0 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/UUIDSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/UUIDSerializer.java
@@ -18,10 +18,10 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.util.UUID;
 
@@ -31,12 +31,12 @@ public class UUIDSerializer extends 
SimpleTypeSerializer<UUID> {
     }
 
     @Override
-    protected UUID readValue(final ByteBuf buffer, final GraphBinaryReader 
context) {
+    protected UUID readValue(final Buffer buffer, final GraphBinaryReader 
context) {
         return new UUID(buffer.readLong(), buffer.readLong());
     }
 
     @Override
-    protected void writeValue(final UUID value, final ByteBuf buffer, final 
GraphBinaryWriter context) {
+    protected void writeValue(final UUID value, final Buffer buffer, final 
GraphBinaryWriter context) {
         
buffer.writeLong(value.getMostSignificantBits()).writeLong(value.getLeastSignificantBits());
     }
 }
\ No newline at end of file
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/VertexPropertySerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/VertexPropertySerializer.java
index 9551fb5..851c13b 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/VertexPropertySerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/VertexPropertySerializer.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import 
org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexProperty;
 
 /**
@@ -36,7 +36,7 @@ public class VertexPropertySerializer extends 
SimpleTypeSerializer<VertexPropert
     }
 
     @Override
-    protected VertexProperty readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected VertexProperty readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final VertexProperty v = new 
ReferenceVertexProperty<>(context.read(buffer),
                 context.readValue(buffer, String.class, false),
                 context.read(buffer));
@@ -51,7 +51,7 @@ public class VertexPropertySerializer extends 
SimpleTypeSerializer<VertexPropert
     }
 
     @Override
-    protected void writeValue(final VertexProperty value, final ByteBuf 
buffer, final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final VertexProperty value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         context.write(value.id(), buffer);
         context.writeValue(value.label(), buffer, false);
         context.write(value.value(), buffer);
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/VertexSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/VertexSerializer.java
index f532e36..ce8ffe1 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/VertexSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/VertexSerializer.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex;
 
 /**
@@ -35,7 +35,7 @@ public class VertexSerializer extends 
SimpleTypeSerializer<Vertex> {
     }
 
     @Override
-    protected Vertex readValue(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    protected Vertex readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         final Vertex v = new ReferenceVertex(context.read(buffer), 
                                              context.readValue(buffer, 
String.class, false));
         
@@ -46,7 +46,7 @@ public class VertexSerializer extends 
SimpleTypeSerializer<Vertex> {
     }
 
     @Override
-    protected void writeValue(final Vertex value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final Vertex value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         context.write(value.id(), buffer);
         context.writeValue(value.label(), buffer, false);
         context.write(null, buffer);
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/YearMonthSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/YearMonthSerializer.java
index 220433a..cff236c 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/YearMonthSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/YearMonthSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.YearMonth;
 
@@ -35,12 +35,12 @@ public class YearMonthSerializer extends 
SimpleTypeSerializer<YearMonth> {
     }
 
     @Override
-    protected YearMonth readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected YearMonth readValue(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         return YearMonth.of(buffer.readInt(), buffer.readByte());
     }
 
     @Override
-    protected void writeValue(final YearMonth value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final YearMonth value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         buffer.writeInt(value.getYear()).writeByte(value.getMonthValue());
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ZoneOffsetSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ZoneOffsetSerializer.java
index f6b3105..7cbbd78 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ZoneOffsetSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ZoneOffsetSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.ZoneOffset;
 
@@ -36,12 +36,12 @@ public class ZoneOffsetSerializer extends 
SimpleTypeSerializer<ZoneOffset> {
     }
 
     @Override
-    protected ZoneOffset readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected ZoneOffset readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         return ZoneOffset.ofTotalSeconds(buffer.readInt());
     }
 
     @Override
-    protected void writeValue(final ZoneOffset value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final ZoneOffset value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         buffer.writeInt(value.getTotalSeconds());
     }
 }
diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ZonedDateTimeSerializer.java
 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ZonedDateTimeSerializer.java
index f7143a1..d9dc8b8 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ZonedDateTimeSerializer.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/ZonedDateTimeSerializer.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.time.LocalDateTime;
 import java.time.ZonedDateTime;
@@ -37,14 +37,14 @@ public class ZonedDateTimeSerializer extends 
SimpleTypeSerializer<ZonedDateTime>
     }
 
     @Override
-    protected ZonedDateTime readValue(final ByteBuf buffer, final 
GraphBinaryReader context) throws SerializationException {
+    protected ZonedDateTime readValue(final Buffer buffer, final 
GraphBinaryReader context) throws SerializationException {
         final LocalDateTime ldt = context.readValue(buffer, 
LocalDateTime.class, false);
         final ZoneOffset zo = context.readValue(buffer, ZoneOffset.class, 
false);
         return ZonedDateTime.of(ldt, zo);
     }
 
     @Override
-    protected void writeValue(final ZonedDateTime value, final ByteBuf buffer, 
final GraphBinaryWriter context) throws SerializationException {
+    protected void writeValue(final ZonedDateTime value, final Buffer buffer, 
final GraphBinaryWriter context) throws SerializationException {
         context.writeValue(value.toLocalDateTime(), buffer, false);
         context.writeValue(value.getOffset(), buffer, false);
     }
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryReaderWriterRoundTripTest.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryReaderWriterRoundTripTest.java
index 8f7874e..6bdd8e2 100644
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryReaderWriterRoundTripTest.java
+++ 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryReaderWriterRoundTripTest.java
@@ -18,8 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
+import org.apache.tinkerpop.gremlin.driver.NettyBufferFactory;
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import 
org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
 import 
org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
@@ -48,6 +48,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.structure.io.IoTest;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceProperty;
@@ -92,6 +93,7 @@ public class GraphBinaryReaderWriterRoundTripTest {
     private final GraphBinaryWriter writer = new GraphBinaryWriter();
     private final GraphBinaryReader reader = new GraphBinaryReader();
     private final ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
+    private static NettyBufferFactory bufferFactory = new NettyBufferFactory();
 
     private static final GraphTraversalSource g = 
TinkerFactory.createModern().traversal();
 
@@ -298,7 +300,7 @@ public class GraphBinaryReaderWriterRoundTripTest {
     public void shouldWriteAndRead() throws Exception {
         // Test it multiple times as the type registry might change its 
internal state
         for (int i = 0; i < 5; i++) {
-            final ByteBuf buffer = allocator.buffer();
+            final Buffer buffer = bufferFactory.create(allocator.buffer());
             writer.write(value, buffer);
             buffer.readerIndex(0);
             final Object result = reader.read(buffer);
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerFailureTests.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerFailureTests.java
index 38296e4..d9eda2a 100644
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerFailureTests.java
+++ 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerFailureTests.java
@@ -19,8 +19,8 @@
 
 package org.apache.tinkerpop.gremlin.driver.ser.binary;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.UnpooledByteBufAllocator;
+import org.apache.tinkerpop.gremlin.driver.NettyBufferFactory;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import 
org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
@@ -30,6 +30,7 @@ import 
org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 import 
org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferencePath;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex;
@@ -52,6 +53,7 @@ public class TypeSerializerFailureTests {
 
     private final GraphBinaryWriter writer = new GraphBinaryWriter();
     private final UnpooledByteBufAllocator allocator = new 
UnpooledByteBufAllocator(false);
+    private static final NettyBufferFactory bufferFactory = new 
NettyBufferFactory();
 
     @Parameterized.Parameters(name = "Value={0}")
     public static Collection input() {
@@ -94,7 +96,7 @@ public class TypeSerializerFailureTests {
 
     @Test
     public void shouldReleaseMemoryWhenFails() {
-        final ByteBuf buffer = allocator.buffer();
+        final Buffer buffer = bufferFactory.create(allocator.buffer());
         try {
             writer.write(value, buffer);
             fail("Should throw exception");
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerRegistryTest.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerRegistryTest.java
index 08de7f2..664a401 100644
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerRegistryTest.java
+++ 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerRegistryTest.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import 
org.apache.tinkerpop.gremlin.driver.ser.binary.types.sample.SamplePerson;
 import 
org.apache.tinkerpop.gremlin.driver.ser.binary.types.sample.SamplePersonSerializer;
 import org.apache.tinkerpop.gremlin.structure.Property;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.junit.Test;
 
 import java.util.UUID;
@@ -138,22 +138,22 @@ public class TypeSerializerRegistryTest {
 
     private static abstract class TestBaseTypeSerializer<T> implements 
TypeSerializer<T> {
         @Override
-        public T read(ByteBuf buffer, GraphBinaryReader context) {
+        public T read(Buffer buffer, GraphBinaryReader context) {
             return null;
         }
 
         @Override
-        public T readValue(ByteBuf buffer, GraphBinaryReader context, boolean 
nullable) {
+        public T readValue(Buffer buffer, GraphBinaryReader context, boolean 
nullable) {
             return null;
         }
 
         @Override
-        public void write(T value, ByteBuf buffer, GraphBinaryWriter context) {
+        public void write(T value, Buffer buffer, GraphBinaryWriter context) {
 
         }
 
         @Override
-        public void writeValue(T value, ByteBuf buffer, GraphBinaryWriter 
context, boolean nullable) {
+        public void writeValue(T value, Buffer buffer, GraphBinaryWriter 
context, boolean nullable) {
 
         }
     }
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CharSerializerTest.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CharSerializerTest.java
index aceae83..0c62a24 100644
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CharSerializerTest.java
+++ 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/CharSerializerTest.java
@@ -18,11 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
 import io.netty.buffer.Unpooled;
 import io.netty.buffer.UnpooledByteBufAllocator;
+import org.apache.tinkerpop.gremlin.driver.NettyBufferFactory;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -37,6 +38,7 @@ import static org.junit.Assert.assertTrue;
 public class CharSerializerTest {
     private final ByteBufAllocator allocator = new 
UnpooledByteBufAllocator(false);
     private static final CharSerializer serializer = new CharSerializer();
+    private static final NettyBufferFactory bufferFactory = new 
NettyBufferFactory();
 
     @Parameterized.Parameters(name = "Character={0}")
     public static Collection input() {
@@ -57,13 +59,13 @@ public class CharSerializerTest {
 
     @Test
     public void readValueTest() throws SerializationException {
-        final Character actual = 
serializer.readValue(Unpooled.wrappedBuffer(byteArray), null);
+        final Character actual = 
serializer.readValue(bufferFactory.create(Unpooled.wrappedBuffer(byteArray)), 
null);
         assertEquals(charValue, actual.charValue());
     }
 
     @Test
     public void writeValueTest() throws SerializationException {
-        final ByteBuf actual = allocator.buffer();
+        final Buffer actual = bufferFactory.create(allocator.buffer());
          serializer.writeValue(charValue, actual, null);
         final byte[] actualBytes = new byte[byteArray.length];
         actual.readBytes(actualBytes);
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializer.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializer.java
index 03b54c3..09cde49 100644
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializer.java
+++ 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializer.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser.binary.types.sample;
 
-import io.netty.buffer.ByteBuf;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.DataType;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import 
org.apache.tinkerpop.gremlin.driver.ser.binary.types.CustomTypeSerializer;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 
 import java.nio.charset.StandardCharsets;
 import java.util.Date;
@@ -45,7 +45,7 @@ public final class SamplePersonSerializer implements 
CustomTypeSerializer<Sample
     }
 
     @Override
-    public SamplePerson read(final ByteBuf buffer, final GraphBinaryReader 
context) throws SerializationException {
+    public SamplePerson read(final Buffer buffer, final GraphBinaryReader 
context) throws SerializationException {
         // {custom type info}, {value_flag} and {value}
         // No custom_type_info
         if (buffer.readInt() != 0) {
@@ -56,7 +56,7 @@ public final class SamplePersonSerializer implements 
CustomTypeSerializer<Sample
     }
 
     @Override
-    public SamplePerson readValue(final ByteBuf buffer, final 
GraphBinaryReader context, final boolean nullable) throws 
SerializationException {
+    public SamplePerson readValue(final Buffer buffer, final GraphBinaryReader 
context, final boolean nullable) throws SerializationException {
         if (nullable) {
             final byte valueFlag = buffer.readByte();
             if ((valueFlag & 1) == 1) {
@@ -83,7 +83,7 @@ public final class SamplePersonSerializer implements 
CustomTypeSerializer<Sample
     }
 
     @Override
-    public void write(final SamplePerson value, final ByteBuf buffer, final 
GraphBinaryWriter context) throws SerializationException {
+    public void write(final SamplePerson value, final Buffer buffer, final 
GraphBinaryWriter context) throws SerializationException {
         // Write {custom type info}, {value_flag} and {value}
         buffer.writeBytes(typeInfoBuffer);
 
@@ -91,7 +91,7 @@ public final class SamplePersonSerializer implements 
CustomTypeSerializer<Sample
     }
 
     @Override
-    public void writeValue(final SamplePerson value, final ByteBuf buffer, 
final GraphBinaryWriter context, final boolean nullable) throws 
SerializationException {
+    public void writeValue(final SamplePerson value, final Buffer buffer, 
final GraphBinaryWriter context, final boolean nullable) throws 
SerializationException {
         if (value == null) {
             if (!nullable) {
                 throw new SerializationException("Unexpected null value when 
nullable is false");
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializerTest.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializerTest.java
index b8cfffa..0944c60 100644
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializerTest.java
+++ 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializerTest.java
@@ -20,6 +20,7 @@ package 
org.apache.tinkerpop.gremlin.driver.ser.binary.types.sample;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
+import org.apache.tinkerpop.gremlin.driver.NettyBufferFactory;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
 import org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
@@ -28,6 +29,7 @@ import 
org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.TypeSerializerRegistry;
 import org.apache.tinkerpop.gremlin.structure.io.AbstractIoRegistry;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.junit.Test;
 import org.mockito.internal.matchers.apachecommons.ReflectionEquals;
 
@@ -46,6 +48,7 @@ import static org.junit.Assert.assertThat;
 public class SamplePersonSerializerTest {
 
     private static final ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
+    private static final NettyBufferFactory bufferFactory = new 
NettyBufferFactory();
 
     @Test
     public void shouldCustomSerializationWithPerson() throws 
SerializationException {
@@ -86,7 +89,7 @@ public class SamplePersonSerializerTest {
                 Date.from(LocalDateTime.of(2005, 8, 5, 1, 
0).toInstant(ZoneOffset.UTC)));
 
         for (boolean nullable: new boolean[] { true, false }) {
-            final ByteBuf buffer = allocator.buffer();
+            final Buffer buffer = bufferFactory.create(allocator.buffer());
             writer.writeValue(person, buffer, nullable);
             final SamplePerson actual = reader.readValue(buffer, 
SamplePerson.class, nullable);
 
diff --git 
a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphBinaryReaderWriterBenchmark.java
 
b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphBinaryReaderWriterBenchmark.java
index d0692b7..a3fdd97 100644
--- 
a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphBinaryReaderWriterBenchmark.java
+++ 
b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphBinaryReaderWriterBenchmark.java
@@ -27,6 +27,7 @@ import 
org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.Level;
@@ -49,20 +50,21 @@ public class GraphBinaryReaderWriterBenchmark extends 
AbstractBenchmarkBase {
     private static GraphBinaryReader reader = new GraphBinaryReader();
     private static GraphBinaryWriter writer = new GraphBinaryWriter();
     private static UnpooledByteBufAllocator allocator = new 
UnpooledByteBufAllocator(false);
+    private static NettyBufferFactory bufferFactory = new NettyBufferFactory();
 
     @State(Scope.Thread)
     public static class BenchmarkState {
-        public ByteBuf bytecodeBuffer1 = allocator.buffer(2048);
-        public ByteBuf bytecodeBuffer2 = allocator.buffer(2048);
-        public ByteBuf pBuffer1 = allocator.buffer(2048);
+        public Buffer bytecodeBuffer1 = 
bufferFactory.create(allocator.buffer(2048));
+        public Buffer bytecodeBuffer2 = 
bufferFactory.create(allocator.buffer(2048));
+        public Buffer pBuffer1 = bufferFactory.create(allocator.buffer(2048));
         public final Bytecode bytecode1 = new Bytecode();
 
-        public ByteBuf bufferWrite = allocator.buffer(2048);
+        public Buffer bufferWrite = 
bufferFactory.create(allocator.buffer(2048));
 
         public Bytecode bytecode2;
 
         @Setup(Level.Trial)
-        public void doSetup() throws IOException, SerializationException {
+        public void doSetup() throws IOException {
             bytecode1.addStep("V");
             bytecode1.addStep("values", "name");
             bytecode1.addStep("tail", 5);
diff --git 
a/gremlin-tools/gremlin-io-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphbinary/GraphBinaryCompatibilityTest.java
 
b/gremlin-tools/gremlin-io-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphbinary/GraphBinaryCompatibilityTest.java
index aa2ad0b..45c1632 100644
--- 
a/gremlin-tools/gremlin-io-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphbinary/GraphBinaryCompatibilityTest.java
+++ 
b/gremlin-tools/gremlin-io-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphbinary/GraphBinaryCompatibilityTest.java
@@ -18,13 +18,13 @@
  */
 package org.apache.tinkerpop.gremlin.structure.io.graphbinary;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
-import io.netty.buffer.UnpooledDirectByteBuf;
 import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.tinkerpop.gremlin.driver.NettyBufferFactory;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader;
 import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter;
 import 
org.apache.tinkerpop.gremlin.structure.io.AbstractTypedCompatibilityTest;
+import org.apache.tinkerpop.gremlin.structure.io.Buffer;
 import org.apache.tinkerpop.gremlin.structure.io.Compatibility;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoCompatibility;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
@@ -48,6 +48,7 @@ public class GraphBinaryCompatibilityTest extends 
AbstractTypedCompatibilityTest
     private static final ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
     private static final GraphBinaryWriter writerV1 = new GraphBinaryWriter();
     private static final GraphBinaryReader readerV1 = new GraphBinaryReader();
+    private static final NettyBufferFactory bufferFactory = new 
NettyBufferFactory();
 
     @Parameterized.Parameters(name = "expect({0})")
     public static Iterable<Object[]> data() {
@@ -67,14 +68,14 @@ public class GraphBinaryCompatibilityTest extends 
AbstractTypedCompatibilityTest
 
     @Override
     public <T> T read(final byte[] bytes, final Class<T> clazz) throws 
Exception {
-        final ByteBuf buffer = allocator.buffer();
+        final Buffer buffer = bufferFactory.create(allocator.buffer());
         buffer.writeBytes(bytes);
         return reader.read(buffer);
     }
 
     @Override
     public byte[] write(final Object o, final Class<?> clazz) throws Exception 
 {
-        final ByteBuf buffer = allocator.buffer();
+        final Buffer buffer = bufferFactory.create(allocator.buffer());
         try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
             writer.write(o, buffer);
             buffer.readerIndex(0);

Reply via email to