Examples of Number640


Examples of net.tomp2p.peers.Number640

      new PeerSync(receiver, 5);

      final Number160 locationKey = new Number160(600);
      final Number160 domainKey = Number160.ZERO;
      final Number160 contentKey = Number160.ZERO;
      Number640 key = new Number640(locationKey, domainKey, contentKey, Number160.ZERO);
      final String newValue = "Test1Test2Test3Test4";

      Data test1 = new Data(newValue.getBytes());

      sender.put(locationKey).data(test1).start().awaitUninterruptibly();

      FutureDone<SyncStat> future = senderSync.synchronize(receiver.peerAddress()).key(key)
              .start();
      future.awaitUninterruptibly();

      System.err.println(future.object().toString());

      Data data = receiver.storageLayer()
              .get(new Number640(locationKey, domainKey, contentKey, Number160.ZERO));
      byte[] reconstructedValue = data.toBytes();
      assertArrayEquals(newValue.getBytes(), reconstructedValue);
      Assert.assertEquals(20, ((SyncStat)future.object()).dataOrig());
      Assert.assertEquals(20, ((SyncStat)future.object()).dataCopy());
    } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.