Allow clients to customize the behavior for a ProtocolViolationException

This is an extension of the work on #333