Improve message writing performance

The advice is to use the context for writing, so let's do precisely
that.

Change-Id: Iab4269dc140f4bfe22753e421feccf8cbe7bce78
Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-731: registration no longer throw exceptions

Since the registrations do not throw them, we can simplify our code,
ridding us of a warning.

Change-Id: I6723f9e09d7419f768f80affea0708439f34c8df
Signed-off-by: Robert Varga <rovarga@cisco.com>
Merge changes I6723f9e0,Iab4269dc

* changes:
  BUG-731: registration no longer throw exceptions
  Improve message writing performance