Fixed JERSEY-1831.

- Fixed potential NPE, added HeadersFactory unit tests, minor pert improvement.

Change-Id: I4b36560ccca5061444528c1de1122a67523d8316
Signed-off-by: Marek Potociar <marek.potociar@oracle.com>
Merge "Fixed JERSEY-1831."