Add unit test for encode-handler
Fix conflicts