use of org.bitcoinj.core.PeerGroup in project bitsquare by bitsquare.
the class WalletAppKitBitSquare method createPeerGroup.
protected PeerGroup createPeerGroup() throws TimeoutException {
// no proxy case.
if (socks5Proxy == null || isLocalHostFullNodeRunning()) {
return super.createPeerGroup();
} else {
// proxy case.
Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(socks5Proxy.getInetAddress().getHostName(), socks5Proxy.getPort()));
// same value used in bitcoinj.
int CONNECT_TIMEOUT_MSEC = 60 * 1000;
ProxySocketFactory proxySocketFactory = new ProxySocketFactory(proxy);
BlockingClientManager mgr = new BlockingClientManager(proxySocketFactory);
PeerGroup peerGroup = new PeerGroup(params, vChain, mgr);
mgr.setConnectTimeoutMillis(CONNECT_TIMEOUT_MSEC);
peerGroup.setConnectTimeoutMillis(CONNECT_TIMEOUT_MSEC);
return peerGroup;
}
}
Aggregations