Some SSL related fixes

The SSL connections would sometimes just hang caused by
incorrect buffer refill logic

Change-Id: Ieb74bf6b8284cb4e83b56680415dfd0f7ed82d9d
Reviewed-on: http://review.couchbase.org/33883
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>