Java Code Examples for com.alibaba.dubbo.remoting.transport.dispatcher.FakeChannelHandlers#setTestingChannelHandlers()

The following examples show how to use com.alibaba.dubbo.remoting.transport.dispatcher.FakeChannelHandlers#setTestingChannelHandlers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HeartbeatHandlerTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientHeartbeat() throws Exception {
    FakeChannelHandlers.setTestingChannelHandlers();
    URL serverURL = URL.valueOf("header://localhost:55555");
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.resetChannelHandlers();
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.connectCount > 0);
    System.out.println("connect count " + handler.connectCount);
}
 
Example 2
Source File: HeartbeatHandlerTest.java    From dubbo-remoting-netty4 with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientHeartbeat() throws Exception {
    FakeChannelHandlers.setTestingChannelHandlers();
    URL serverURL = URL.valueOf("header://localhost:55555?transporter=netty4");
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.resetChannelHandlers();
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.connectCount > 0);
    System.out.println("connect count " + handler.connectCount);
}
 
Example 3
Source File: HeartbeatHandlerTest.java    From dubbo-remoting-netty4 with Apache License 2.0 5 votes vote down vote up
@Test
public void testServerHeartbeat() throws Exception {
    URL serverURL = URL.valueOf("header://localhost:55555?transporter=netty4");
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.setTestingChannelHandlers();
    serverURL = serverURL.removeParameter(Constants.HEARTBEAT_KEY);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.disconnectCount > 0);
    System.out.println("disconnect count " + handler.disconnectCount);
}
 
Example 4
Source File: HeartbeatHandlerTest.java    From dubbo-remoting-netty4 with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientHeartbeat() throws Exception {
    FakeChannelHandlers.setTestingChannelHandlers();
    URL serverURL = URL.valueOf("header://localhost:55555?transporter=netty4");
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.resetChannelHandlers();
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.connectCount > 0);
    System.out.println("connect count " + handler.connectCount);
}
 
Example 5
Source File: HeartbeatHandlerTest.java    From dubbo-remoting-netty4 with Apache License 2.0 5 votes vote down vote up
@Test
public void testServerHeartbeat() throws Exception {
    URL serverURL = URL.valueOf("header://localhost:55555?transporter=netty4");
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.setTestingChannelHandlers();
    serverURL = serverURL.removeParameter(Constants.HEARTBEAT_KEY);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.disconnectCount > 0);
    System.out.println("disconnect count " + handler.disconnectCount);
}
 
Example 6
Source File: HeartbeatHandlerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientHeartbeat() throws Exception {
    FakeChannelHandlers.setTestingChannelHandlers();
    URL serverURL = URL.valueOf("header://localhost:55555");
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.resetChannelHandlers();
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.connectCount > 0);
    System.out.println("connect count " + handler.connectCount);
}
 
Example 7
Source File: HeartbeatHandlerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testServerHeartbeat() throws Exception {
    URL serverURL = URL.valueOf("header://localhost:55555");
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.setTestingChannelHandlers();
    serverURL = serverURL.removeParameter(Constants.HEARTBEAT_KEY);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.disconnectCount > 0);
    System.out.println("disconnect count " + handler.disconnectCount);
}
 
Example 8
Source File: HeartbeatHandlerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientHeartbeat() throws Exception {
    FakeChannelHandlers.setTestingChannelHandlers();
    URL serverURL = URL.valueOf("header://localhost:55555");
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.resetChannelHandlers();
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.connectCount > 0);
    System.out.println("connect count " + handler.connectCount);
}
 
Example 9
Source File: HeartbeatHandlerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testServerHeartbeat() throws Exception {
    URL serverURL = URL.valueOf("header://localhost:55555");
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.setTestingChannelHandlers();
    serverURL = serverURL.removeParameter(Constants.HEARTBEAT_KEY);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.disconnectCount > 0);
    System.out.println("disconnect count " + handler.disconnectCount);
}
 
Example 10
Source File: HeartbeatHandlerTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Test
public void testServerHeartbeat() throws Exception {
    URL serverURL = URL.valueOf("header://localhost:55555");
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.setTestingChannelHandlers();
    serverURL = serverURL.removeParameter(Constants.HEARTBEAT_KEY);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.disconnectCount > 0);
    System.out.println("disconnect count " + handler.disconnectCount);
}
 
Example 11
Source File: HeartbeatHandlerTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
@Test
public void testServerHeartbeat() throws Exception {
    URL serverURL = URL.valueOf("header://localhost:55555");
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.setTestingChannelHandlers();
    serverURL = serverURL.removeParameter(Constants.HEARTBEAT_KEY);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.disconnectCount > 0);
    System.out.println("disconnect count " + handler.disconnectCount);
}
 
Example 12
Source File: HeartbeatHandlerTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientHeartbeat() throws Exception {
    FakeChannelHandlers.setTestingChannelHandlers();
    URL serverURL = URL.valueOf("header://localhost:55555");
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.resetChannelHandlers();
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.connectCount > 0);
    System.out.println("connect count " + handler.connectCount);
}
 
Example 13
Source File: HeartbeatHandlerTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
@Test
public void testServerHeartbeat() throws Exception {
    URL serverURL = URL.valueOf("header://localhost:55555");
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.setTestingChannelHandlers();
    serverURL = serverURL.removeParameter(Constants.HEARTBEAT_KEY);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.disconnectCount > 0);
    System.out.println("disconnect count " + handler.disconnectCount);
}
 
Example 14
Source File: HeartbeatHandlerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientHeartbeat() throws Exception {
    FakeChannelHandlers.setTestingChannelHandlers();
    URL serverURL = URL.valueOf("header://localhost:55555");
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.resetChannelHandlers();
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.connectCount > 0);
    System.out.println("connect count " + handler.connectCount);
}
 
Example 15
Source File: HeartbeatHandlerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testServerHeartbeat() throws Exception {
    URL serverURL = URL.valueOf("header://localhost:55555");
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.setTestingChannelHandlers();
    serverURL = serverURL.removeParameter(Constants.HEARTBEAT_KEY);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.disconnectCount > 0);
    System.out.println("disconnect count " + handler.disconnectCount);
}
 
Example 16
Source File: HeartbeatHandlerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientHeartbeat() throws Exception {
    FakeChannelHandlers.setTestingChannelHandlers();
    URL serverURL = URL.valueOf("header://localhost:55555?transporter=netty4");
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.resetChannelHandlers();
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.connectCount > 0);
    System.out.println("connect count " + handler.connectCount);
}
 
Example 17
Source File: HeartbeatHandlerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testServerHeartbeat() throws Exception {
    URL serverURL = URL.valueOf("header://localhost:55555?transporter=netty4");
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.setTestingChannelHandlers();
    serverURL = serverURL.removeParameter(Constants.HEARTBEAT_KEY);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.disconnectCount > 0);
    System.out.println("disconnect count " + handler.disconnectCount);
}
 
Example 18
Source File: HeartbeatHandlerTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientHeartbeat() throws Exception {
    FakeChannelHandlers.setTestingChannelHandlers();
    URL serverURL = URL.valueOf("header://localhost:55555");
    TestHeartbeatHandler handler = new TestHeartbeatHandler();
    server = Exchangers.bind(serverURL, handler);
    System.out.println("Server bind successfully");

    FakeChannelHandlers.resetChannelHandlers();
    serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
    client = Exchangers.connect(serverURL);
    Thread.sleep(10000);
    Assert.assertTrue(handler.connectCount > 0);
    System.out.println("connect count " + handler.connectCount);
}