Added test/example directory and one example.

Fixed a but in the code because of which new messages were created
even though there were no new messages (error in comparing messageid
values).