diff --git a/src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/ReadUtil.java b/src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/ReadUtil.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/ReadUtil.java
+++ b/src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/ReadUtil.java
@@ -35,12 +35,16 @@ public final class ReadUtil {
      */
     public static int safeRead(final InputStream inputStream, final byte[] buffer) throws IOException {
         int readBytes = inputStream.read(buffer);
+        if(readBytes == -1) {
+            return -1;
+        }
         if(readBytes < buffer.length) {
             int offset = readBytes;
             int left = buffer.length;
             left = left - readBytes;
             do {
                 try {
+                    System.out.println(buffer.length + ":"+offset+":"+left);
                     final int nr = inputStream.read(buffer, offset, left);
                     if (nr == -1) {
                         return nr;
fix silly connection drop bug - it would throw a quite unexpected indexoutofbounds exception before, now it is a SQLNonTransientConnectionException instead