Java 类io.netty.bootstrap.AbstractBootstrap 实例源码

项目:yajsw    文件:ReconnectHandler.java   
protected void connect(AbstractBootstrap bootstrap)
{
    Channel channel = null;
    Constants.ahessianLogger.warn("reconnecting...");
    while (channel == null && !_stop)
        try
        {
            channel = ((Bootstrap) bootstrap).connect().sync().channel();
        }
        catch (Exception ex)
        {
            if (ex instanceof ConnectException)
            {
                System.out.println(ex);
                try
                {
                    Thread.sleep(RECONNECT_DELAY);
                }
                catch (InterruptedException e)
                {
                    e.printStackTrace();
                }
            }
        }

}
项目:netty4.0.27Learn    文件:SocketTestPermutation.java   
protected <A extends AbstractBootstrap<?, ?>, B extends AbstractBootstrap<?, ?>>
List<BootstrapComboFactory<A, B>> combo(List<BootstrapFactory<A>> sbfs, List<BootstrapFactory<B>> cbfs) {

    List<BootstrapComboFactory<A, B>> list = new ArrayList<BootstrapComboFactory<A, B>>();

    // Populate the combinations
    for (BootstrapFactory<A> sbf: sbfs) {
        for (BootstrapFactory<B> cbf: cbfs) {
            final BootstrapFactory<A> sbf0 = sbf;
            final BootstrapFactory<B> cbf0 = cbf;
            list.add(new BootstrapComboFactory<A, B>() {
                @Override
                public A newServerInstance() {
                    return sbf0.newInstance();
                }

                @Override
                public B newClientInstance() {
                    return cbf0.newInstance();
                }
            });
        }
    }

    return list;
}
项目:netty4.0.27Learn    文件:EpollReuseAddrTest.java   
private static void testMultipleBindDatagramChannelWithoutReusePortFails0(AbstractBootstrap<?, ?> bootstrap) {
    bootstrap.handler(new DummyHandler());
    ChannelFuture future = bootstrap.bind().syncUninterruptibly();
    try {
        bootstrap.bind().syncUninterruptibly();
        Assert.fail();
    } catch (Exception e) {
        Assert.assertTrue(e instanceof IOException);
    }
    future.channel().close().syncUninterruptibly();
}
项目:jreactive-8583    文件:Iso8583ChannelInitializerTest.java   
@Test
public void testInitChannelWithLogger() throws Exception {
    //given
    configurationBuilder.withAddLoggingHandler(true);
    Iso8583ChannelInitializer<Channel, AbstractBootstrap, ConnectorConfiguration> channelInitializer = createChannelInitializer(configurer);

    // when
    channelInitializer.initChannel(channel);

    //then
    verify(pipeline).addLast(same(workerGroup), eq("logging"), any(IsoMessageLoggingHandler.class));
}
项目:jreactive-8583    文件:Iso8583ChannelInitializerTest.java   
@Test
public void testInitChannelWithoutLogger() throws Exception {
    //given
    configurationBuilder.withAddLoggingHandler(false);

    Iso8583ChannelInitializer<Channel, AbstractBootstrap, ConnectorConfiguration> channelInitializer = createChannelInitializer(configurer);

    //when
    channelInitializer.initChannel(channel);

    //then
    verify(pipeline, never()).addLast(any(EventLoopGroup.class), anyString(), any(IsoMessageLoggingHandler.class));
}
项目:jreactive-8583    文件:Iso8583ChannelInitializerTest.java   
private Iso8583ChannelInitializer<Channel, AbstractBootstrap, ConnectorConfiguration> createChannelInitializer(ConnectorConfigurer<ConnectorConfiguration, AbstractBootstrap> configurer) {
    return new Iso8583ChannelInitializer<>(
            configurationBuilder.build(),
            configurer,
            workerGroup,
            messageFactory,
            handlers);
}
项目:jreactive-8583    文件:AbstractIso8583ConnectorTest.java   
@Before
public void setUp() throws Exception {
    compositeIsoMessageHandler = new CompositeIsoMessageHandler<>();
    subject = new AbstractIso8583Connector<ConnectorConfiguration, AbstractBootstrap, M>(
            config, messageFactory, compositeIsoMessageHandler
    ) {
        @Override
        protected AbstractBootstrap createBootstrap() {
            throw new UnsupportedOperationException("Method is not implemented: .createBootstrap");
        }
    };
}
项目:yajsw    文件:ChannelPipelineFactoryFactory.java   
public ChannelPipelineFactory create(EventExecutorGroup group,
AbstractBootstrap bootstrap);
项目:yajsw    文件:ChannelPipelineFactoryBuilder.java   
@Override
public ChannelPipelineFactory create(EventExecutorGroup group,
        AbstractBootstrap bootstrap)
{
    ChannelPipelineFactory result;
    if (isRPCServer() && isRPC() && _serverFactory == null)
    {
        _serverFactory = new HessianRPCServiceHandler(
                Executors.newCachedThreadPool(), _serviceOptions, TIMER);
        _serverFactory.setConnectListener(_connectedListener);
        _serverFactory.setDisconnectListener(_disconnectedListener);
        if (isExecutorService())
            _serverFactory
                    .addService(
                            "default",
                            new ExecutorInvokeService(
                                    _serverService,
                                    _serverServiceInterface,
                                    _serverFactory,
                                    Executors
                                            .newFixedThreadPool(_executorThreads)));
        else
            _serverFactory.addService("default",
                    new ImmediateInvokeService(_serverService,
                            _serverServiceInterface, _serverFactory));
    }
    else if (isRPC() && _clientFactory == null)
    {
        Executor executor = _executorThreads > 0 ? Executors
                .newFixedThreadPool(_executorThreads) : Executors
                .newSingleThreadExecutor();
        String name = "NONAME?";
        _clientFactory = new HessianProxyFactory(executor, name,
                _serviceOptions);
    }

    if (hasSession())
    {
        result = basePipelineFactory(
                mixinPipelineFactory(group, bootstrap), group, bootstrap);
    }
    else
        result = mergePipelineFactory(
                basePipelineFactory(group, bootstrap),
                mixinPipelineFactory(group, bootstrap));

    if (_debug)
        result.debug();

    return result;
}
项目:yajsw    文件:ChannelPipelineFactoryBuilder.java   
private ChannelPipelineFactory basePipelineFactory(
        EventExecutorGroup group, AbstractBootstrap bootstrap)
{
    return basePipelineFactory(null, group, bootstrap);
}
项目:reactor-netty    文件:NettyOptions.java   
private void defaultNettyOptions(AbstractBootstrap<?, ?> bootstrap) {
    bootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
}
项目:yajsw    文件:BootstrapProvider.java   
public AbstractBootstrap getBootstrap();
项目:datacollector    文件:BaseNettyServer.java   
protected abstract AbstractBootstrap bootstrap(boolean enableEpoll);