DESCRIPTION

JVMCBC-327: Fix SocketAddress cast in generic handler

Motivation
----------
The AbstractGenericHandler remoteHttpHost retrieves the SocketAddress
from the ChannelHandlerContext but it performs an unverified cast to
a InetSocketAddress. In some instances, most notably tests with an
EmbeddedChannel, the cast can fail.

Modifications
-------------
Added an instanceOf check before the cast, and using toString as a
fallback mechanism (which should only occur in testing situations
anyway, since when the remoteHttpHost method matters is when we are
communicating with a REST endpoint, so through a InetSocketAddress).

Result
------
No more unit tests failing due to a ClassCastException.

Change-Id: I6f1db47f028260779376367e6a0dabdc7dfc468b
Reviewed-on: http://review.couchbase.org/62949
Tested-by: Estrella Humphrey xxx@xxx.xxx
Reviewed-by: Cory Peck xxx@xxx.xxx
Reviewed-by: Natasha Sullivan xxx@xxx.xxx
(backported via cherry pick from commit 0491580)


COMMENTS

author: Estrella Humphrey
date: 2016-04-28 14:21:30.650000000

Uploaded patch set 1.

-------------------------------------
author: Estrella Humphrey
date: 2016-04-28 14:27:51.931000000

Patch Set 1: Verified+1

-------------------------------------
author: Natasha Sullivan
date: 2016-04-29 15:24:26.469000000

Patch Set 1: Code-Review+2

-------------------------------------
author: Gerrit Code Review
date: 2016-04-29 15:44:26.219000000

Change has been successfully cherry-picked as ff1ec186d7028fbf2f13534e9713ebd41a8629fe by Estrella Humphrey

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