IO Refactor for memcached

This fixes some issues in the Memcached I/O.
Previously we were using a simple write with nonblocking I/O; where we'd
issue a chan.write() call and discard the buffer regardless of whether
all bytes were written or not. This caused data to get lost if the TCP
write buffer was full and caused me lots of frustration on Windows
(where this happened quite frequently).

Change-Id: Ib7ae9b3a82f6818697032b1a17f33a98f4003bbd
Reviewed-on: http://review.couchbase.org/28120
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Invert isUnlocked

It is easier to read and parse the logic when the variable
name represent the state (and isn't inverted).

Change-Id: Ic95cc19b9c6bada52805712cebdca9316af6dd45
Reviewed-on: http://review.couchbase.org/28337
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
Tested-by: Trond Norbye <trond.norbye@gmail.com>