Package com.alibaba.dubbo.remoting

Examples of com.alibaba.dubbo.remoting.Channel


//TODO response test
public class HeaderExchangeHandlerTest {
   
    @Test
    public void test_received_request_oneway() throws RemotingException{
        final Channel mchannel = new MockedChannel();
       
        final Person requestdata = new Person("charles");
        Request request = new Request();
        request.setTwoWay(false);
        request.setData(requestdata);
View Full Code Here


        final Request request = new Request();
        request.setTwoWay(true);
        request.setData(requestdata);
       
        final AtomicInteger count = new AtomicInteger(0);
        final Channel mchannel = new MockedChannel(){
            @Override
            public void send(Object message) throws RemotingException {
                Response res = (Response)message;
                Assert.assertEquals(request.getId(), res.getId());
                Assert.assertEquals(request.getVersion(), res.getVersion());
View Full Code Here

        final Request request = new Request();
        request.setTwoWay(true);
        request.setData(requestdata);
       
        final AtomicInteger count = new AtomicInteger(0);
        final Channel mchannel = new MockedChannel(){
            @Override
            public void send(Object message) throws RemotingException {
                Response res = (Response)message;
                Assert.assertEquals(request.getId(), res.getId());
                Assert.assertEquals(request.getVersion(), res.getVersion());
View Full Code Here

        request.setTwoWay(true);
        request.setData(new BizException());
        request.setBroken(true);
       
        final AtomicInteger count = new AtomicInteger(0);
        final Channel mchannel = new MockedChannel(){
            @Override
            public void send(Object message) throws RemotingException {
                Response res = (Response)message;
                Assert.assertEquals(request.getId(), res.getId());
                Assert.assertEquals(request.getVersion(), res.getVersion());
View Full Code Here

    public void test_received_request_event_readonly() throws RemotingException{
        final Request request = new Request();
        request.setTwoWay(true);
        request.setEvent(Request.READONLY_EVENT);
       
        final Channel mchannel = new MockedChannel();
        HeaderExchangeHandler hexhandler = new HeaderExchangeHandler(new MockedExchangeHandler());
        hexhandler.received(mchannel, request);
        Assert.assertTrue(mchannel.hasAttribute(Constants.CHANNEL_ATTRIBUTE_READONLY_KEY));
    }
View Full Code Here

    public void test_received_request_event_other_discard() throws RemotingException{
        final Request request = new Request();
        request.setTwoWay(true);
        request.setEvent("my event");
       
        final Channel mchannel = new MockedChannel(){
            @Override
            public void send(Object message) throws RemotingException {
                Assert.fail();
            }
        };
View Full Code Here

    public InetSocketAddress getConnectAddress() {
        return new InetSocketAddress(NetUtils.filterLocalHost(getUrl().getHost()), getUrl().getPort());
    }

    public InetSocketAddress getRemoteAddress() {
        Channel channel = getChannel();
        if (channel == null)
            return getUrl().toInetSocketAddress();
        return channel.getRemoteAddress();
    }
View Full Code Here

            return getUrl().toInetSocketAddress();
        return channel.getRemoteAddress();
    }

    public InetSocketAddress getLocalAddress() {
        Channel channel = getChannel();
        if (channel == null)
            return InetSocketAddress.createUnresolved(NetUtils.getLocalHost(), 0);
        return channel.getLocalAddress();
    }
View Full Code Here

            return InetSocketAddress.createUnresolved(NetUtils.getLocalHost(), 0);
        return channel.getLocalAddress();
    }

    public boolean isConnected() {
        Channel channel = getChannel();
        if (channel == null)
            return false;
        return channel.isConnected();
    }
View Full Code Here

            return false;
        return channel.isConnected();
    }

    public Object getAttribute(String key) {
        Channel channel = getChannel();
        if (channel == null)
            return null;
        return channel.getAttribute(key);
    }
View Full Code Here

TOP

Related Classes of com.alibaba.dubbo.remoting.Channel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.