@Test
public void testProcessMessage() throws Exception
{

    MessageImpl message = new MessageImpl( LOCAL_PEER_ID, PAYLOAD );
    Envelope envelope = new Envelope( message, LOCAL_PEER_ID, RECIPIENT, TIME_TO_LIVE, HEADERS );
    MessageListener listener = mock( MessageListener.class );
    messenger.addMessageListener( listener );
    when( listener.getRecipient() ).thenReturn( RECIPIENT );
    messenger.processMessage( JsonUtil.toJson( envelope ) );
    verify( notificationExecutor ).execute( isA( MessageNotifier.class ) );
    //test exception
    try
    {
        messenger.processMessage( null );
        fail( "Expected message exception" );
    }
    catch ( MessageException e )
    {
    }
}