CCBC-150: Do a deep search to locate commands

Change-Id: Ic66ef44c129bbed64037b1fe09e0a152d54f035a
Reviewed-on: http://review.couchbase.org/23633
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
regression-unit-test.cc requires CouchbaseMock.jar

Change-Id: I63e4d4e116679f61ea0ae50fdde2f8bde0dbc244
Reviewed-on: http://review.couchbase.org/23666
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
CCBC-159 Allow to handle large operation buffers

Function do_read_data() has internal limit for operations handled per
call and currently it is hardcoded as 1000. With conjuntion that
lcb_server_event_handler() might register itself for READ event
awaiting the data from the socket when output buffer is empty, it
leads to timeouts when the limit was reached _and_ output buffer is
empty.

This patch does the following:

* always setup RW event if either output or input buffers has the data
* check for pure write event first in the handler
* add alternative check for read event, it will be triggered either
  when READ event received or input buffer isn't empty

This is the 2nd commit message
==============================

CCBC-159 Fix MockUnitTest.testPurgedBody

Update socket timer only if there was real job done like reading or
writing data.

Fixes http://sdkbuilds.couchbase.com/job/libcouchbase/406

This is the 3rd commit message
==============================

CCBC-160 Fix incorrect reschedule of batched commands

* do not call lcb_server_event_handler() directly, but rather schedule it
* properly breakout the while loop in do_read_data()
* do not call recvv() when we are parsing input on WRITE event