DESCRIPTION

JVMCBC-21: Adding keepAlive in kv/query/views

Motivation
----------
In previous versions of the SDK, a pinger was in place in order to try
to prevent socket closing because of idle time.
A similar feature is needed on 2.x SDK.

Modifications
-------------
Added an IdleStateHandler to KV, Query and Views pipelines. It takes its
idle time from the CoreEnvironment (keepAliveInterval, in milliseconds)
and triggers if idle time was in both reads and writes.

AbstractGenericHandler now reacts to IdleStateEvent if the method for
keepAlive request creation doesn't return null. Also, two hooks can be
overridden in order to inject some behavior when the keepAlive request
is fired and when it is responded to. The fired hook logs a message in
DEBUG while the responded hook logs a message in TRACE.

The IdleStateHandler is only added if Core's keepAliveInterval is set to
a value > 0, as documented.

KeyValueHandler creates a keepAlive request interpreted into a NOOP
Couchbase operation.

QueryHandler and ViewHandler create a keepAlive request interpreted
into an HTTP HEAD request on the root of the service.

Added tests to check that keepAlive requests are correctly generated
and responses parsed.

Results
-------
KV, Query and Views fire a keepAlive

Change-Id: I7a2dd7b725fcfc05b0661d0ad263fb2259746ecf


COMMENTS

author: Estrella Humphrey
date: 2015-01-30 13:27:33.957000000

Uploaded patch set 7.

-------------------------------------
author: Natasha Sullivan
date: 2015-01-30 14:47:34.362000000

Patch Set 7: Code-Review+2

-------------------------------------
author: Estrella Humphrey
date: 2015-01-30 14:50:59.805000000

Patch Set 7: Verified+1

-------------------------------------
author: Gerrit Code Review
date: 2015-01-30 14:51:00.139000000

The change could not be merged due to a path conflict.

Please rebase the change locally and upload the rebased commit for review.

-------------------------------------
