 +                int sslRead = SSL.readFromSSL(ssl, address, buffer.limit());
 +                if (sslRead > 0) {
 +                    read.set(sslRead);
-+                    buffer.get(dst.array(), dst.position(), sslRead);
-+                    dst.position(dst.position() + sslRead);
++                    if (dst.hasArray()) {
++                        buffer.get(dst.array(), dst.position(), sslRead);
++                        dst.position(dst.position() + sslRead);
++                    } else {
++                        int lim = buffer.limit();
++                        buffer.limit(sslRead);
++                        dst.put(buffer);
++                        buffer.limit(lim);
++                    }
 +                }
 +            }
 +        };

+                if (len > buffer.capacity())
+                    throw new RuntimeException("Buffer pool write overflow");
+
+                buffer.put(src.array(), src.position(), len);
+                int sslWrote = SSL.writeToSSL(ssl, address, len);
+                if (sslWrote > 0) {
+                    written.set(sslWrote);

+                if (len > buffer.capacity())
+                    throw new RuntimeException("Buffer pool write overflow");
+
+                if (src.hasArray()) {
+                    buffer.put(src.array(), src.position(), len);
+                } else {
+                    int pos = src.position();
+                    int lim = src.limit();
+                    src.limit(len);
+                    buffer.put(src);
+                    src.position(pos).limit(lim);
+                }
+                int netWrote = SSL.writeToBIO(networkBIO, address, len);
+                if (netWrote > -1) {
+                    written.set(netWrote);
