Exemplo n.º 1
0
 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 neoscoin nodes on localhost.
 }
Exemplo n.º 2
0
 @Override
 public void tearDown() {
   try {
     super.tearDown();
     blockJobs = false;
     Utils.finishMockSleep();
     if (peerGroup.isRunning()) peerGroup.stopAsync();
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
Exemplo n.º 3
0
 protected InboundMessageQueuer connectPeerWithoutVersionExchange(int id) throws Exception {
   Preconditions.checkArgument(id < PEER_SERVERS);
   InetSocketAddress remoteAddress = new InetSocketAddress("127.0.0.1", 2000 + id);
   Peer peer = peerGroup.connectTo(remoteAddress).getConnectionOpenFuture().get();
   InboundMessageQueuer writeTarget = newPeerWriteTargetQueue.take();
   writeTarget.peer = peer;
   return writeTarget;
 }