Package net.tomp2p.message

Examples of net.tomp2p.message.Message.intValue()


    // we need to make a copy of the original message
    Message rconMessage = new Message();
    rconMessage.sender(message.sender());
    rconMessage.version(message.version());
    // store the message id in the payload to get the cached message later
    rconMessage.intValue(message.messageId());
    // the message must have set the keepAlive Flag true. If not, the relay
    // peer will close the PeerConnection to the unreachable peer.
    rconMessage.keepAlive(true);
    // making the message ready to send
    PeerAddress recipient = message.recipient().changeAddress(socketAddress.inetAddress())
View Full Code Here


  public void testMessageEncode() throws Exception {

    int intVal = 42;

    Message m1 = Utils2.createDummyMessage();
    m1.intValue(intVal);
   
    Encoder encoder = new Encoder(null); // TODO signaturefactory?

    AlternativeCompositeByteBuf buf = AlternativeCompositeByteBuf.compBuffer(); // TODO what buffer to use?
   
View Full Code Here

    ns.add(message.sender());
    forwardMessage.neighborsSet(ns);

    if (!message.intList().isEmpty()) {
      // store the message id for new message to identify the cached message afterwards
      forwardMessage.intValue(message.intAt(0));
    }

    return forwardMessage;
  }
View Full Code Here

  private Message createReadyForRequestMessage(final Message message, final PeerAddress receiver) {
    Message readyForRequestMessage = createMessage(receiver, RPC.Commands.RCON.getNr(), Message.Type.REQUEST_3);

    if (!message.intList().isEmpty()) {
      // forward the message id to indentify the cached message afterwards
      readyForRequestMessage.intValue(message.intAt(0));
    }

    // keep the new connection open
    readyForRequestMessage.keepAlive(true);
View Full Code Here

        if (getBuilder.to() != null && getBuilder.from() != null) {
            final Collection<Number640> keys = new ArrayList<Number640>(2);
            keys.add(getBuilder.from());
            keys.add(getBuilder.to());
            message.intValue(getBuilder.returnNr());
            message.keyCollection(new KeyCollection(keys));
        } else if (getBuilder.keys() == null) {

            if (getBuilder.locationKey() == null || getBuilder.domainKey() == null) {
                throw new IllegalArgumentException("Null not allowed in location or domain");
View Full Code Here

            if (getBuilder.contentKeys() != null) {
                message.keyCollection(new KeyCollection(getBuilder.locationKey(), getBuilder
                        .domainKey(), getBuilder.versionKey(), getBuilder.contentKeys()));
            } else {
                message.intValue(getBuilder.returnNr());
                if (getBuilder.keyBloomFilter() != null || getBuilder.contentBloomFilter() != null) {
                    if (getBuilder.keyBloomFilter() != null) {
                        message.bloomFilter(getBuilder.keyBloomFilter());
                    }
                    if (getBuilder.contentBloomFilter() != null) {
View Full Code Here

        if (getBuilder.to() != null && getBuilder.from() != null) {
            final Collection<Number640> keys = new ArrayList<Number640>(2);
            keys.add(getBuilder.from());
            keys.add(getBuilder.to());
            message.intValue(getBuilder.returnNr());
            message.keyCollection(new KeyCollection(keys));
        } else if (getBuilder.keys() == null) {

            if (getBuilder.locationKey() == null || getBuilder.domainKey() == null) {
                throw new IllegalArgumentException("Null not allowed in location or domain");
View Full Code Here

            if (getBuilder.contentKeys() != null) {
                message.keyCollection(new KeyCollection(getBuilder.locationKey(), getBuilder
                        .domainKey(), getBuilder.versionKey(), getBuilder.contentKeys()));
            } else {
                message.intValue(getBuilder.returnNr());
                if (getBuilder.keyBloomFilter() != null || getBuilder.contentBloomFilter() != null) {
                    if (getBuilder.keyBloomFilter() != null) {
                        message.bloomFilter(getBuilder.keyBloomFilter());
                    }
                    if (getBuilder.contentBloomFilter() != null) {
View Full Code Here

        if (removeBuilder.to() != null && removeBuilder.from() != null) {
            final Collection<Number640> keys = new ArrayList<Number640>(2);
            keys.add(removeBuilder.from());
            keys.add(removeBuilder.to());
            //marker
            message.intValue(0);
            message.keyCollection(new KeyCollection(keys));
        } else if (removeBuilder.keys() == null) {

            if (removeBuilder.locationKey() == null || removeBuilder.domainKey() == null) {
                throw new IllegalArgumentException("Null not allowed in location or domain");
View Full Code Here

    // depend on the relay type whether to keep the connection open or close it after the setup.
    message.keepAlive(relayType.keepConnectionOpen());

    // encode the relay type in the message such that the relay node knows how to handle
    message.intValue(relayType.ordinal());

    // server credentials only used by Android peers
    if (relayType == RelayType.ANDROID) {
      if (gcmServerCredentials == null) {
        LOG.error("No available GCM server found. Seems that they are all occupied. Configure more during peer setup!");
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.