Example usage for io.netty.channel ChannelFactory ChannelFactory

List of usage examples for io.netty.channel ChannelFactory ChannelFactory

Introduction

In this page you can find the example usage for io.netty.channel ChannelFactory ChannelFactory.

Prototype

ChannelFactory

Source Link

Usage

From source file:io.grpc.netty.NettyChannelBuilderTest.java

License:Apache License

@Test
public void assertEventLoopAndChannelType_onlyFactoryProvided() {
    NettyChannelBuilder builder = NettyChannelBuilder.forTarget("fakeTarget");
    builder.channelFactory(new ChannelFactory<Channel>() {
        @Override/*from  ww  w  .j ava  2 s  .  c o m*/
        public Channel newChannel() {
            return null;
        }
    });
    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("Both EventLoopGroup and ChannelType should be provided");

    builder.assertEventLoopAndChannelType();
}

From source file:io.grpc.netty.Utils.java

License:Apache License

private static ChannelFactory<ServerChannel> nioServerChannelFactory() {
    return new ChannelFactory<ServerChannel>() {
        @Override/*from   w  ww  . ja  v a2 s  . c  om*/
        public ServerChannel newChannel() {
            return new NioServerSocketChannel();
        }
    };
}

From source file:org.stem.client.old.StorageNodeClient.java

License:Apache License

private void initBootstrap() {
    bootstrap = new Bootstrap();

    EventLoopGroup workerGroup = new NioEventLoopGroup();

    bootstrap.group(workerGroup).channel(NioSocketChannel.class).option(ChannelOption.SO_KEEPALIVE, true)
            .option(ChannelOption.TCP_NODELAY, true)
            //.option(ChannelOption.SO_TIMEOUT, 100)

            .handler(new ChannelFactory());
}