BUG-1233: fix thread safety

Writing the shared buffer is subject to races, as concurrent
serializeMessage() invocation may see the indices shifted. Correct this
by acquiding a slice() of the buffer. Also renames the static fields to
eliminate sonar warnings.

Change-Id: Ia42668e1645f6179ef122c0ffe3b831be16b42f4
Signed-off-by: Robert Varga <rovarga@cisco.com>