Java 类org.jboss.netty.channel.local.DefaultLocalClientChannelFactory 实例源码

项目:mandrel    文件:NiftyClient.java   
public NiftyClient(NettyClientConfig nettyClientConfig, boolean local) {
    this.nettyClientConfig = nettyClientConfig;
    if (local) {
        log.warn("Using local client");
        this.channelFactory = new DefaultLocalClientChannelFactory();
        this.timer = null;
        this.bossExecutor = null;
        this.workerExecutor = null;
        this.defaultSocksProxyAddress = null;
    } else {
        this.timer = nettyClientConfig.getTimer();
        this.bossExecutor = nettyClientConfig.getBossExecutor();
        this.workerExecutor = nettyClientConfig.getWorkerExecutor();
        this.defaultSocksProxyAddress = nettyClientConfig.getDefaultSocksProxyAddress();

        int bossThreadCount = nettyClientConfig.getBossThreadCount();
        int workerThreadCount = nettyClientConfig.getWorkerThreadCount();

        NioWorkerPool workerPool = new NioWorkerPool(workerExecutor, workerThreadCount, ThreadNameDeterminer.CURRENT);
        NioClientBossPool bossPool = new NioClientBossPool(bossExecutor, bossThreadCount, timer, ThreadNameDeterminer.CURRENT);

        this.channelFactory = new NioClientSocketChannelFactory(bossPool, workerPool);
    }
}
项目:jersey-netty    文件:ChunkedRequestAssemblerTest.java   
@Test
public void addChunkHandlesNonExistingChunkList() {
    DefaultLocalClientChannelFactory channelFactory = new DefaultLocalClientChannelFactory();
    DefaultChannelPipeline pipeline = new DefaultChannelPipeline();
    Channel channel = channelFactory.newChannel(pipeline);
    chunkedRequestAssembler.addChunk(channel, EMPTY_CHUNK);
}
项目:jersey-netty    文件:ChunkedRequestAssemblerTest.java   
@Test
public void addChunkHandlesNullChunk() {
    DefaultLocalClientChannelFactory channelFactory = new DefaultLocalClientChannelFactory();
    DefaultChannelPipeline pipeline = new DefaultChannelPipeline();
    Channel channel = channelFactory.newChannel(pipeline);
    chunkedRequestAssembler.addChunk(channel, null);
}
项目:jersey-netty    文件:ChunkedRequestAssemblerTest.java   
@Test
public void addChunkHandlesExistingChunkList() {
    DefaultLocalClientChannelFactory channelFactory = new DefaultLocalClientChannelFactory();
    DefaultChannelPipeline pipeline = new DefaultChannelPipeline();
    Channel channel = channelFactory.newChannel(pipeline);
    HttpRequest httpRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "");
    chunkedRequestAssembler.setup(channel, httpRequest);
    chunkedRequestAssembler.addChunk(channel, EMPTY_CHUNK);
}