Refactoring Xor En and Dec. Fix MockWritablechannel.