Fixed unit testing for message sending

Issue: #333