当前位置: 首页>>代码示例>>Java>>正文


Java EthereumChannelInitializer类代码示例

本文整理汇总了Java中org.ethereum.net.server.EthereumChannelInitializer的典型用法代码示例。如果您正苦于以下问题:Java EthereumChannelInitializer类的具体用法?Java EthereumChannelInitializer怎么用?Java EthereumChannelInitializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EthereumChannelInitializer类属于org.ethereum.net.server包,在下文中一共展示了EthereumChannelInitializer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connectAsync

import org.ethereum.net.server.EthereumChannelInitializer; //导入依赖的package包/类
public ChannelFuture connectAsync(String host, int port, String remoteId, boolean discoveryMode) {
    ethereumListener.trace("Connecting to: " + host + ":" + port);

    EthereumChannelInitializer ethereumChannelInitializer = ethereumChannelInitializerFactory.newInstance(remoteId);
    ethereumChannelInitializer.setPeerDiscoveryMode(discoveryMode);

    Bootstrap b = new Bootstrap();
    b.group(workerGroup);
    b.channel(NioSocketChannel.class);

    b.option(ChannelOption.SO_KEEPALIVE, true);
    b.option(ChannelOption.MESSAGE_SIZE_ESTIMATOR, DefaultMessageSizeEstimator.DEFAULT);
    b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.peerConnectionTimeout());
    b.remoteAddress(host, port);

    b.handler(ethereumChannelInitializer);

    // Start the client.
    return b.connect();
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:21,代码来源:PeerClient.java

示例2: connectAsync

import org.ethereum.net.server.EthereumChannelInitializer; //导入依赖的package包/类
public ChannelFuture connectAsync(String host, int port, String remoteId, boolean discoveryMode) {
    ethereumListener.trace("Connecting to: " + host + ":" + port);

    EthereumChannelInitializer ethereumChannelInitializer = ctx.getBean(EthereumChannelInitializer.class, remoteId);
    ethereumChannelInitializer.setPeerDiscoveryMode(discoveryMode);

    Bootstrap b = new Bootstrap();
    b.group(workerGroup);
    b.channel(NioSocketChannel.class);

    b.option(ChannelOption.SO_KEEPALIVE, true);
    b.option(ChannelOption.MESSAGE_SIZE_ESTIMATOR, DefaultMessageSizeEstimator.DEFAULT);
    b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.peerConnectionTimeout());
    b.remoteAddress(host, port);

    b.handler(ethereumChannelInitializer);

    // Start the client.
    return b.connect();
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:21,代码来源:PeerClient.java

示例3: newInstance

import org.ethereum.net.server.EthereumChannelInitializer; //导入依赖的package包/类
EthereumChannelInitializer newInstance(String remoteId); 
开发者ID:rsksmart,项目名称:rskj,代码行数:2,代码来源:EthereumChannelInitializerFactory.java


注:本文中的org.ethereum.net.server.EthereumChannelInitializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。