@Override public void closeConnections(int n) { if (!isRunning()) throw new IllegalStateException(); synchronized (clients) { Iterator<BlockingClient> it = clients.iterator(); while (n-- > 0 && it.hasNext()) it.next().closeConnection(); } } }
checkNotNull(torClient); DRMWorkaround.maybeDisableExportControls(); BlockingClientManager manager = new BlockingClientManager(torClient.getSocketFactory()); final int CONNECT_TIMEOUT_MSEC = TOR_TIMEOUT_SECONDS * 1000; manager.setConnectTimeoutMillis(CONNECT_TIMEOUT_MSEC); PeerGroup result = new PeerGroup(context, chain, manager, torClient); result.setConnectTimeoutMillis(CONNECT_TIMEOUT_MSEC);
public TestWithNetworkConnections(ClientType clientType) { this.clientType = clientType; if (clientType == ClientType.NIO_CLIENT_MANAGER) channels = new NioClientManager(); else if (clientType == ClientType.BLOCKING_CLIENT_MANAGER) channels = new BlockingClientManager(); else channels = null; }
checkNotNull(torClient); DRMWorkaround.maybeDisableExportControls(); BlockingClientManager manager = new BlockingClientManager(torClient.getSocketFactory()); final int CONNECT_TIMEOUT_MSEC = TOR_TIMEOUT_SECONDS * 1000; manager.setConnectTimeoutMillis(CONNECT_TIMEOUT_MSEC); PeerGroup result = new PeerGroup(context, chain, manager, torClient); result.setConnectTimeoutMillis(CONNECT_TIMEOUT_MSEC);
public NetworkAbstractionTests(Integer clientType) throws Exception { this.clientType = clientType; if (clientType == 0) { channels = new NioClientManager(); channels.startAsync(); } else if (clientType == 1) { channels = new BlockingClientManager(); channels.startAsync(); } else channels = null; }
@Override public void closeConnections(int n) { if (!isRunning()) throw new IllegalStateException(); synchronized (clients) { Iterator<BlockingClient> it = clients.iterator(); while (n-- > 0 && it.hasNext()) it.next().closeConnection(); } } }
protected void initPeerGroup() { if (clientType == ClientType.NIO_CLIENT_MANAGER) peerGroup = createPeerGroup(new NioClientManager()); else peerGroup = createPeerGroup(new BlockingClientManager()); peerGroup.setPingIntervalMsec(0); // Disable the pings as they just get in the way of most tests. peerGroup.addWallet(wallet); peerGroup.setUseLocalhostPeerWhenPossible(false); // Prevents from connecting to bitcoin nodes on localhost. }
@Override public void closeConnections(int n) { if (!isRunning()) throw new IllegalStateException(); synchronized (clients) { Iterator<BlockingClient> it = clients.iterator(); while (n-- > 0 && it.hasNext()) it.next().closeConnection(); } } }
@Override public void closeConnections(int n) { if (!isRunning()) throw new IllegalStateException(); synchronized (clients) { Iterator<BlockingClient> it = clients.iterator(); while (n-- > 0 && it.hasNext()) it.next().closeConnection(); } } }
@Override public ListenableFuture<SocketAddress> openConnection(SocketAddress serverAddress, StreamConnection connection) { try { if (!isRunning()) throw new IllegalStateException(); return new BlockingClient(serverAddress, connection, connectTimeoutMillis, socketFactory, clients).getConnectFuture(); } catch (IOException e) { throw new RuntimeException(e); // This should only happen if we are, eg, out of system resources } }
@Override public ListenableFuture<SocketAddress> openConnection(SocketAddress serverAddress, StreamConnection connection) { try { if (!isRunning()) throw new IllegalStateException(); return new BlockingClient(serverAddress, connection, connectTimeoutMillis, socketFactory, clients).getConnectFuture(); } catch (IOException e) { throw new RuntimeException(e); // This should only happen if we are, eg, out of system resources } }
@Override public ListenableFuture<SocketAddress> openConnection(SocketAddress serverAddress, StreamConnection connection) { try { if (!isRunning()) throw new IllegalStateException(); return new BlockingClient(serverAddress, connection, connectTimeoutMillis, socketFactory, clients).getConnectFuture(); } catch (IOException e) { throw new RuntimeException(e); // This should only happen if we are, eg, out of system resources } }
@Override public ListenableFuture<SocketAddress> openConnection(SocketAddress serverAddress, StreamConnection connection) { try { if (!isRunning()) throw new IllegalStateException(); return new BlockingClient(serverAddress, connection, connectTimeoutMillis, socketFactory, clients).getConnectFuture(); } catch (IOException e) { throw new RuntimeException(e); // This should only happen if we are, eg, out of system resources } }