Refactor AbstractMsgTest to be generic.
Add some unit test for set(key, value, optimizeLength);