MessageRequestListener extends MessageListener implements Disposable { @Override public void onMessage( final Message message ) { MessageRequest messageRequest = message.getPayload( MessageRequest.class ); for ( RequestListener listener : localPeer.getRequestListeners() ) { if ( messageRequest.getRecipient().equalsIgnoreCase( listener.getRecipient() ) ) { notifier.execute( new RequestNotifier( messenger, listener, message, messageRequest, localPeer ) ); return; } } } MessageRequestListener( LocalPeer localPeer, Messenger messenger ); @Override void dispose(); @Override void onMessage( final Message message );  }
@Test public void testOnMessage() throws Exception { listener.onMessage( message ); verify( notifier ).execute( isA( RequestNotifier.class ) ); }