Package org.jgroups

Examples of org.jgroups.Message



    public static void testSizeMessageWithAdditionalData() throws Exception {
        UUID dest=UUID.randomUUID();
        dest.setAdditionalData("bela".getBytes());
        Message msg=new Message(dest, null, null);
        _testSize(msg);
    }
View Full Code Here


        _testSize(msg);
    }


    public static void testSizeMessageWithDestAndSrcAndHeaders() throws Exception {
        Message msg=new Message(UUID.randomUUID(), UUID.randomUUID(), "bela".getBytes());
        addHeaders(msg);
        _testSize(msg);
    }
View Full Code Here

                return;
            }

            while(num_msgs.getAndDecrement() > 0) {
                long seqno=current_seqno.getAndIncrement();
                Message msg=createMessage(dest, sender, seqno, oob, false);
                unicast.up(new Event(Event.MSG, msg));
            }
        }
View Full Code Here

                   AgentServer.getName() + "JGroups send detachable not " + m);
//        return;
      }
    }

    Message msg = new Message(null, null, obj);
    synchronized (lock) {
      channel.send(msg);
      lock.wait();
    }
  }
View Full Code Here

        unicast.setMaxMessageBatchSize(max_msg_batch_size);
        unicast.setValue("max_bytes", 20000);

        // send the first message manually, to initialize the AckReceiverWindow tables
        Message msg=createMessage(local_addr, sender, 1L, oob, true);
        unicast.up(new Event(Event.MSG, msg));
        Util.sleep(500);


        final CountDownLatch latch=new CountDownLatch(1);
View Full Code Here

        }
        System.out.println("OK");
    }

    private static Message createMessage(Address dest, Address src, long seqno, boolean oob, boolean first) {
        Message msg=new Message(dest, src, "hello world");
        UNICAST2.Unicast2Header hdr=UNICAST2.Unicast2Header.createDataHeader(seqno, (short)1, first);
        msg.putHeader(UNICAST_ID, hdr);
        if(oob)
            msg.setFlag(Message.OOB);
        return msg;
    }
View Full Code Here

                return;
            }

            while(num_msgs.getAndDecrement() > 0) {
                long seqno=current_seqno.getAndIncrement();
                Message msg=createMessage(dest, sender, seqno, oob, false);
                unicast.up(new Event(Event.MSG, msg));
            }
        }
View Full Code Here

        MockObserver observer=new MockObserver();
        encrypt.setObserver(observer);

        encrypt.keyServer=true;
        String messageText="hello this is a test message";
        Message msg=new Message(null, null, messageText.getBytes());

        Event event=new Event(Event.MSG, msg);
        encrypt.down(event);
        Message sentMsg=(Message)((Event)observer.getDownMessages().get("message0")).getArg();
        String encText=new String(sentMsg.getBuffer());
        assert !encText.equals(messageText);
        Cipher cipher=encrypt2.getSymDecodingCipher();
        byte[] decodedBytes=cipher.doFinal(sentMsg.getBuffer());
        String temp=new String(decodedBytes);
        System.out.println("decoded text:" + temp);
        assert temp.equals(messageText);

    }
View Full Code Here

        digest.reset();
        digest.update(encrypt.getDesKey().getEncoded());

        String symVersion=new String(digest.digest(), "UTF-8");

        Message msg=new Message(null, null, encodedBytes);
        msg.putHeader(ENCRYPT_ID, new ENCRYPT.EncryptHeader(ENCRYPT.EncryptHeader.ENCRYPT, symVersion));
        Event event=new Event(Event.MSG, msg);
        encrypt.up(event);
        Message rcvdMsg=(Message)((Event)observer.getUpMessages().get("message0")).getArg();
        String decText=new String(rcvdMsg.getBuffer());

        assert decText.equals(messageText);

    }
View Full Code Here

        digest.reset();
        digest.update(encrypt2.getDesKey().getEncoded());

        String symVersion=new String(digest.digest());

        Message msg=new Message(null, null, encodedBytes);
        msg.putHeader(ENCRYPT_ID, new ENCRYPT.EncryptHeader(ENCRYPT.EncryptHeader.ENCRYPT, symVersion));
        Event event=new Event(Event.MSG, msg);
        encrypt.up(event);
        assert observer.getUpMessages().isEmpty();

    }
View Full Code Here

TOP

Related Classes of org.jgroups.Message

Copyright © 2018 www.massapicom. 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.