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


COMMENTS

author: Estrella Humphrey
date: 2016-04-18 08:38:35.036000000

Uploaded patch set 1.

-------------------------------------
author: Estrella Humphrey
date: 2016-04-18 08:38:54.318000000

Patch Set 1: Verified+1

-------------------------------------
author: Cory Peck
date: 2016-04-18 08:40:04.460000000

Patch Set 1: Code-Review+2

-------------------------------------
author: Natasha Sullivan
date: 2016-04-18 08:40:35.342000000

Patch Set 1: Code-Review+2

-------------------------------------
author: Gerrit Code Review
date: 2016-04-18 08:47:06.968000000

Change has been successfully cherry-picked as 0491580f1d1c52df3d96058d22160f35e19c6d6c

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