Search in sources :

Example 1 with ExchangeHandlerDispatcher

use of org.apache.dubbo.remoting.exchange.support.ExchangeHandlerDispatcher in project dubbo by alibaba.

the class ExchangersTest method testBind.

@Test
public void testBind() throws RemotingException {
    String url = "dubbo://127.0.0.1:12345?exchanger=mockExchanger";
    Exchangers.bind(url, Mockito.mock(Replier.class));
    Exchangers.bind(url, new ChannelHandlerAdapter(), Mockito.mock(Replier.class));
    Exchangers.bind(url, new ExchangeHandlerDispatcher());
    Assertions.assertThrows(RuntimeException.class, () -> Exchangers.bind((URL) null, new ExchangeHandlerDispatcher()));
    Assertions.assertThrows(RuntimeException.class, () -> Exchangers.bind(url, (ExchangeHandlerDispatcher) null));
}
Also used : ChannelHandlerAdapter(org.apache.dubbo.remoting.transport.ChannelHandlerAdapter) Replier(org.apache.dubbo.remoting.exchange.support.Replier) ExchangeHandlerDispatcher(org.apache.dubbo.remoting.exchange.support.ExchangeHandlerDispatcher) URL(org.apache.dubbo.common.URL) Test(org.junit.jupiter.api.Test)

Example 2 with ExchangeHandlerDispatcher

use of org.apache.dubbo.remoting.exchange.support.ExchangeHandlerDispatcher in project dubbo by alibaba.

the class ExchangersTest method testConnect.

@Test
public void testConnect() throws RemotingException {
    String url = "dubbo://127.0.0.1:12345?exchanger=mockExchanger";
    Exchangers.connect(url);
    Exchangers.connect(url, Mockito.mock(Replier.class));
    Exchangers.connect(URL.valueOf(url), Mockito.mock(Replier.class));
    Exchangers.connect(url, new ChannelHandlerAdapter(), Mockito.mock(Replier.class));
    Exchangers.connect(url, new ExchangeHandlerDispatcher());
    Assertions.assertThrows(RuntimeException.class, () -> Exchangers.connect((URL) null, new ExchangeHandlerDispatcher()));
    Assertions.assertThrows(RuntimeException.class, () -> Exchangers.connect(url, (ExchangeHandlerDispatcher) null));
}
Also used : ChannelHandlerAdapter(org.apache.dubbo.remoting.transport.ChannelHandlerAdapter) Replier(org.apache.dubbo.remoting.exchange.support.Replier) ExchangeHandlerDispatcher(org.apache.dubbo.remoting.exchange.support.ExchangeHandlerDispatcher) URL(org.apache.dubbo.common.URL) Test(org.junit.jupiter.api.Test)

Aggregations

URL (org.apache.dubbo.common.URL)2 ExchangeHandlerDispatcher (org.apache.dubbo.remoting.exchange.support.ExchangeHandlerDispatcher)2 Replier (org.apache.dubbo.remoting.exchange.support.Replier)2 ChannelHandlerAdapter (org.apache.dubbo.remoting.transport.ChannelHandlerAdapter)2 Test (org.junit.jupiter.api.Test)2