Example usage for org.springframework.integration.dispatcher MessageDispatcher removeHandler

List of usage examples for org.springframework.integration.dispatcher MessageDispatcher removeHandler

Introduction

In this page you can find the example usage for org.springframework.integration.dispatcher MessageDispatcher removeHandler.

Prototype

boolean removeHandler(MessageHandler handler);

Source Link

Document

Remove a message handler.

Usage

From source file:org.springframework.integration.channel.P2pChannelTests.java

@Test
public void testCustomChannelLoggingWithMoreThenOneSubscriberNotAbstractDispatcher() {
    final MessageDispatcher mockDispatcher = mock(MessageDispatcher.class);
    when(mockDispatcher.addHandler(Mockito.any(MessageHandler.class))).thenReturn(true);
    when(mockDispatcher.removeHandler(Mockito.any(MessageHandler.class))).thenReturn(true).thenReturn(false)
            .thenReturn(true);//from ww  w  .  j  av  a2 s.co  m

    final AbstractSubscribableChannel channel = new AbstractSubscribableChannel() {
        @Override
        protected MessageDispatcher getDispatcher() {
            return mockDispatcher;
        }
    };
    channel.setBeanName("customChannel");

    verifySubscriptions(channel);
}