change the sendMessage for Unit tests.