Fixed Checkstyle error
Using CodecRegistry for message encoding to ensure that the correct BsonDocument Codec is used depending on the actual class of the document
(which may be a RawBsonDocument or a BsonDocumentWrapper).