Java Code Examples for com.alibaba.dubbo.common.Constants#BIND_PORT_KEY

The following examples show how to use com.alibaba.dubbo.common.Constants#BIND_PORT_KEY . 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: GrizzlyTransporterTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldAbleToBindGrizzly() throws Exception {
    int port = NetUtils.getAvailablePort();
    URL url = new URL("http", "localhost", port,
            new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)});

    Server server = new GrizzlyTransporter().bind(url, new ChannelHandlerAdapter());

    assertThat(server.isBound(), is(true));
}
 
Example 2
Source File: NettyTransporterTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldAbleToBindNetty4() throws Exception {
    int port = NetUtils.getAvailablePort();
    URL url = new URL("http", "localhost", port,
            new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)});

    Server server = new NettyTransporter().bind(url, new ChannelHandlerAdapter());

    assertThat(server.isBound(), is(true));
}