diff --git a/lib/java/src/org/apache/thrift/transport/TZlibTransport.java b/lib/java/src/org/apache/thrift/transport/TZlibTransport.java
index 25c9d01..06965c5 100644
--- a/lib/java/src/org/apache/thrift/transport/TZlibTransport.java
+++ b/lib/java/src/org/apache/thrift/transport/TZlibTransport.java
@@ -164,8 +164,9 @@
     @Override
     public void flush() throws TTransportException {
         byte[] buf = writeBuffer_.get();
+        int bufLength = writeBuffer_.len();
         writeBuffer_.reset();
-        compresser.setInput(buf);
+        compresser.setInput(buf, 0, bufLength);
 
         byte[] compBuf = new byte[buf.length * 2];
         int compressedDataLength = compresser.deflate(compBuf, 0, compBuf.length, Deflater.SYNC_FLUSH);
diff --git a/lib/java/test/org/apache/thrift/transport/TestTZlibTransport.java b/lib/java/test/org/apache/thrift/transport/TestTZlibTransport.java
new file mode 100644
index 0000000..74817b1
--- /dev/null
+++ b/lib/java/test/org/apache/thrift/transport/TestTZlibTransport.java
@@ -0,0 +1,116 @@
+/*
+ * 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 java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.zip.DataFormatException;
+import java.util.zip.DeflaterOutputStream;
+import java.util.zip.Inflater;
+import java.util.zip.InflaterInputStream;
+
+import junit.framework.TestCase;
+
+public class TestTZlibTransport extends TestCase {
+
+  protected TTransport getTransport(TTransport underlying) {
+    return new TZlibTransport(underlying);
+  }
+
+  public static byte[] byteSequence(int start, int end) {
+    byte[] result = new byte[end-start+1];
+    for (int i = 0; i <= (end-start); i++) {
+      result[i] = (byte)(start+i);
+    }
+    return result;
+  }
+
+  public void testRead() throws IOException, TTransportException {
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(baos);
+    DataOutputStream dos = new DataOutputStream(deflaterOutputStream);
+    dos.write(byteSequence(0, 49));
+    dos.write(byteSequence(0, 219));
+
+    deflaterOutputStream.finish();
+
+    TMemoryBuffer membuf = new TMemoryBuffer(0);
+    membuf.write(baos.toByteArray());
+
+    ReadCountingTransport countTrans = new ReadCountingTransport(membuf);
+    TTransport trans = getTransport(countTrans);
+
+    byte[] readBuf = new byte[10];
+    trans.read(readBuf, 0, 10);
+    assertTrue(Arrays.equals(readBuf, byteSequence(0,9)));
+    assertEquals(1, countTrans.readCount);
+
+    trans.read(readBuf, 0, 10);
+    assertTrue(Arrays.equals(readBuf, byteSequence(10,19)));
+    assertEquals(1, countTrans.readCount);
+
+    assertEquals(30, trans.read(new byte[30], 0, 30));
+    assertEquals(1, countTrans.readCount);
+
+    readBuf = new byte[220];
+    assertEquals(220, trans.read(readBuf, 0, 220));
+    assertTrue(Arrays.equals(readBuf, byteSequence(0, 219)));
+    assertEquals(1, countTrans.readCount);
+  }
+
+  public void testWrite() throws TTransportException, IOException, DataFormatException {
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    WriteCountingTransport countingTrans = new WriteCountingTransport(new TIOStreamTransport(new BufferedOutputStream(baos)));
+    TTransport trans = getTransport(countingTrans);
+
+    trans.write(byteSequence(0, 100));
+    assertEquals(0, countingTrans.writeCount);
+    trans.write(byteSequence(101, 200));
+    trans.write(byteSequence(201, 255));
+    assertEquals(0, countingTrans.writeCount);
+
+    trans.flush();
+    assertEquals(1, countingTrans.writeCount);
+
+    trans.write(byteSequence(0, 245));
+    trans.flush();
+    assertEquals(2, countingTrans.writeCount);
+
+    DataInputStream din = new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(baos.toByteArray())));
+    byte[] buf = new byte[256];
+    int n = din.read(buf, 0, 256);
+    assertEquals(n, 256);
+    assertTrue(Arrays.equals(byteSequence(0, 255), buf));
+
+    buf = new byte[246];
+    n = din.read(buf, 0, 246);
+    assertEquals(n, 246);
+    for (int i = 0; i<buf.length; i++) {
+      assertEquals("for "+i, byteSequence(0,245)[i], buf[i]);
+    }
+
+    assertTrue(Arrays.equals(byteSequence(0,245), buf));
+  }
+
+}
