Expose generateNewMessageID() and add tests.