use of com.ctrip.xpipe.netty.commands.NettyClientFactory in project x-pipe by ctripcorp.
the class AbstractCommandTest method createClientPool.
protected FixedObjectPool<NettyClient> createClientPool(String host, int port) throws Exception {
NettyClientFactory nettyClientFactory = new NettyClientFactory(new InetSocketAddress(host, port));
nettyClientFactory.start();
stoppables.add(nettyClientFactory);
NettyClient nettyClient = nettyClientFactory.makeObject().getObject();
FixedObjectPool<NettyClient> clientPool = new FixedObjectPool<NettyClient>(nettyClient);
return clientPool;
}
use of com.ctrip.xpipe.netty.commands.NettyClientFactory in project x-pipe by ctripcorp.
the class XpipeNettyClientPool method doInitialize.
@Override
protected void doInitialize() throws Exception {
this.factory = new NettyClientFactory(target);
this.factory.start();
GenericObjectPool<NettyClient> genericObjectPool = new GenericObjectPool<>(factory, config);
genericObjectPool.setTestOnBorrow(true);
genericObjectPool.setTestOnCreate(true);
this.objectPool = genericObjectPool;
}
Aggregations