diff --git a/lib/haxe/src/org/apache/thrift/transport/TBufferedTransport.hx b/lib/haxe/src/org/apache/thrift/transport/TBufferedTransport.hx
new file mode 100644
index 0000000..4b33fcf
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TBufferedTransport.hx
@@ -0,0 +1,155 @@
+/*
+ * 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.thrift.transport;
+
+import org.apache.thrift.transport.*;
+
+import haxe.io.Eof;
+import haxe.io.Bytes;
+import haxe.io.BytesBuffer;
+import haxe.io.BytesOutput;
+import haxe.io.BytesInput;
+
+
+class TBufferedTransport extends TTransport
+{
+    // constants
+    public static inline var DEFAULT_BUFSIZE : Int = 0x1000;    // 4096 Bytes
+    public static inline var MIN_BUFSIZE : Int = 0x100;         // 256 Bytes
+    public static inline var MAX_BUFSIZE : Int = 0x100000;      // 1 MB
+
+    // Underlying transport
+    public var transport(default,null) :  TTransport = null;
+
+    // Buffer for input/output
+    private var readBuffer_ : BytesInput = null;
+    private var writeBuffer_ : BytesOutput = null;
+    private var bufSize : Int;
+
+    // Constructor wraps around another transport
+    public function new( transport : TTransport, bufSize : Int = DEFAULT_BUFSIZE) {
+
+        // ensure buffer size is in the range
+        if ( bufSize < MIN_BUFSIZE)
+            bufSize = MIN_BUFSIZE;
+        else if( bufSize > MAX_BUFSIZE)
+            bufSize = MAX_BUFSIZE;
+
+        this.transport = transport;
+        this.bufSize = bufSize;
+        this.writeBuffer_ = new BytesOutput();
+        this.writeBuffer_.bigEndian = true;
+    }
+
+    public override function open() : Void {
+        transport.open();
+    }
+
+    public override function isOpen() : Bool {
+        return transport.isOpen();
+    }
+
+    public override function close() : Void {
+        transport.close();
+    }
+
+    public override function read(buf : BytesBuffer, off : Int, len : Int) : Int {
+        try {
+            var data = Bytes.alloc(len);
+
+            while( true) {
+                if ((readBuffer_ != null) && (readBuffer_.position < readBuffer_.length)) {
+                    var got = readBuffer_.readBytes(data, 0, len);
+                    if (got > 0) {
+                        buf.addBytes(data, 0, got);
+                        return got;
+                    }
+                }
+
+                // there is no point in buffering whenever the
+                // remaining length exceeds the buffer size
+                if ( len >= bufSize) {
+                    var got = transport.read( buf, off, len);
+                    if (got > 0) {
+                        buf.addBytes(data, 0, got);
+                        return got;
+                    }
+                }
+
+                // fill the buffer
+                if ( readChunk() <= 0)
+                    break;
+            }
+
+            throw new TTransportException(TTransportException.END_OF_FILE, 'Can\'t read $len bytes!');
+        }
+        catch (eof : Eof) {
+            throw new TTransportException(TTransportException.END_OF_FILE, 'Can\'t read $len bytes!');
+        }
+    }
+
+    function readChunk() : Int {
+        var size = bufSize;
+        try {
+            var buffer = new BytesBuffer();
+            size = transport.read( buffer, 0, size);
+            readBuffer_ = new BytesInput( buffer.getBytes(), 0, size);
+            readBuffer_.bigEndian = true;
+            return size;
+        }
+        catch(eof : Eof) {
+            throw new TTransportException(TTransportException.END_OF_FILE, 'Can\'t read $size bytes!');
+        }
+    }
+
+    private function writeChunk(forceWrite : Bool) : Void {
+        if( writeBuffer_.length > 0) {
+            if ( forceWrite || (writeBuffer_.length >= bufSize)) {
+                var buf = writeBuffer_.getBytes();
+                writeBuffer_ = new BytesOutput();
+                writeBuffer_.bigEndian = true;
+                transport.write(buf, 0, buf.length);
+            }
+        }
+    }
+
+    public override function write(buf : Bytes, off : Int, len : Int) : Void {
+        var halfSize : Int = Std.int(bufSize / 2);
+
+        // No point in buffering if len exceeds the buffer size.
+        // However, if the buffer is less than half full we should still consider
+        // squashing all into one write, except when the actual write len is very large.
+        var huge_write : Bool = (len >= (2 * bufSize));
+        var exceeds_buf : Bool = huge_write || (len >= bufSize);
+        var write_thru : Bool = exceeds_buf && (writeBuffer_.length >= halfSize);
+        if ( write_thru) {
+            writeChunk(true); // force send whatever we have in there
+            transport.write(buf, off, len);  // write thru
+        } else {
+            writeBuffer_.writeBytes(buf, off, len);
+            writeChunk(false);
+        }
+    }
+
+    public override function flush( callback : Dynamic->Void =null) : Void {
+        writeChunk(true);
+        transport.flush(callback);
+    }
+}
diff --git a/lib/haxe/src/org/apache/thrift/transport/TBufferedTransportFactory.hx b/lib/haxe/src/org/apache/thrift/transport/TBufferedTransportFactory.hx
new file mode 100644
index 0000000..539e720
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TBufferedTransportFactory.hx
@@ -0,0 +1,37 @@
+/*
+ * 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.thrift.transport;
+
+import org.apache.thrift.transport.*;
+
+
+class TBufferedTransportFactory extends TTransportFactory {
+
+    private var bufSize : Int;
+
+    public function new(bufSize : Int = TBufferedTransport.DEFAULT_BUFSIZE) {
+        super();
+        this.bufSize = bufSize;
+    }
+
+    public override function getTransport(base : TTransport) : TTransport {
+        return new TBufferedTransport(base, bufSize);
+    }
+}
diff --git a/lib/haxe/src/org/apache/thrift/transport/TSocket.hx b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
index b6f2119..8aa0608 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
@@ -73,6 +73,8 @@
     private var output : Output = null;
     #end
 
+    private static inline var DEFAULT_TIMEOUT = 5.0;
+
     private var obuffer : BytesOutput = new BytesOutput();
     private var ioCallback : TException->Void = null;
     private var readCount : Int = 0;
@@ -117,7 +119,8 @@
         }
     }
 
-
+    // Reads up to len bytes into buffer buf, starting att offset off.
+    // May return less bytes than len required
     public override function read( buf : BytesBuffer, off : Int, len : Int) : Int   {
         try
         {
@@ -149,10 +152,12 @@
                 input.read(off-readCount);
                 readCount = off;
             }
-            var data = input.read(len);
-            readCount += data.length;
-            buf.add(data);
-            return data.length;
+
+            var data = Bytes.alloc(len);
+            var got = input.readBytes(data, 0, len);
+            buf.addBytes( data, 0, got);
+            readCount += got;
+            return got;
 
             #end
         }
@@ -269,7 +274,7 @@
         var socket = new Socket();
         socket.setBlocking(true);
         socket.setFastSend(true);
-        socket.setTimeout(5.0);
+        socket.setTimeout( DEFAULT_TIMEOUT);
         socket.connect(host, port);
 
         #end
diff --git a/test/haxe/src/TestClient.hx b/test/haxe/src/TestClient.hx
index 3f9158e..276cd0f 100644
--- a/test/haxe/src/TestClient.hx
+++ b/test/haxe/src/TestClient.hx
@@ -200,8 +200,7 @@
         }
         if ( args.buffered) {
             trace("- buffered transport");
-            throw "TBufferedTransport not implemented yet";
-            //transport = new TBufferedTransport(transport);
+            transport = new TBufferedTransport(transport);
         }
 
         // protocol
diff --git a/test/haxe/src/TestServer.hx b/test/haxe/src/TestServer.hx
index e9c838f..502d0d1 100644
--- a/test/haxe/src/TestServer.hx
+++ b/test/haxe/src/TestServer.hx
@@ -56,8 +56,7 @@
             }
             if ( args.buffered) {
                 trace("- buffered transport");
-                throw "TBufferedTransport not implemented yet";
-                //transfactory = new TBufferedTransportFactory();
+                transfactory = new TBufferedTransportFactory();
             }
 
             // protocol
