Updated the code to match the protocol spec

Change-Id: Ia52677f9da1fcd5ff0a71b4ae79eac8928bdef08
Reviewed-on: http://review.couchbase.org/29677
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>