Package org.jgroups

Examples of org.jgroups.Address


        ct1.send(null, data, 0, data.length);
    }

    public void testSendEmptyData() throws Exception {
        byte[]  data=new byte[0];
        Address myself=ct1.getLocalAddress();
        ct1.setReceiver(new TCPConnectionMap.Receiver() {
            public void receive(Address sender, byte[] data, int offset, int length) {}
        });
        ct1.send(myself, data, 0, data.length);
    }
View Full Code Here


        });
        ct1.send(myself, data, 0, data.length);
    }

    public void testSendNullData() throws Exception {
        Address myself=ct1.getLocalAddress();
        ct1.send(myself, null, 0, 0);
    }
View Full Code Here

    }


    public void testSendToSelf() throws Exception {
        long       NUM=1000, total_time;
        Address    myself=ct1.getLocalAddress();
        MyReceiver r=new MyReceiver(ct1, NUM, false);
        byte[]     data=new byte[] {'b', 'e', 'l', 'a'};

        ct1.setReceiver(r);
View Full Code Here

        Assert.assertEquals(r.getNumExpected(), r.getNumReceived());
    }

    public void testSendToOther() throws Exception {
        long       NUM=1000, total_time;
        Address    other=ct2.getLocalAddress();
        MyReceiver r=new MyReceiver(ct2, NUM, false);
        byte[]     data=new byte[] {'b', 'e', 'l', 'a'};

        ct2.setReceiver(r);
View Full Code Here

    }


    public void testSendToOtherGetResponse() throws Exception {
        long       NUM=1000, total_time;
        Address    other=ct2.getLocalAddress();
        MyReceiver r1=new MyReceiver(ct1, NUM, false);
        MyReceiver r2=new MyReceiver(ct2, NUM, true); // send response
        byte[]     data=new byte[] {'b', 'e', 'l', 'a'};

        ct1.setReceiver(r1);
View Full Code Here

        Assert.assertEquals(a5, m1.elementAt(3));
        m1.sort();
        System.out.println("sorted: " + m1);
        Assert.assertEquals(4, m1.size());

        Address addr0=m1.elementAt(0);
        Address addr1=m1.elementAt(1);
        Address addr2=m1.elementAt(2);
        Address addr3=m1.elementAt(3);

        System.out.println("sorted membership:\n" + printUUIDs(m1));
        assert addr0.compareTo(addr1) < 0;
        assert addr1.compareTo(addr2) < 0;
        assert addr2.compareTo(addr3) < 0;
View Full Code Here

        Assert.assertEquals(rl.size(), keys.size());
    }


    public void testAddRsp() {
        Address tmp=Util.createRandomAddress();
        rl.addRsp(tmp, new Integer(322649));
        Assert.assertEquals(6, rl.size());
        Rsp rsp=rl.get(tmp);
        assert rsp != null;
        assert rsp.wasReceived();
View Full Code Here

     * Current record: 84 bytes (March 2010)
     * Prev: 166, 109, 103, 84
     * @throws Exception
     */
    public static void testMulticast() throws Exception {
        Address src=Util.createRandomAddress();
        Message msg=createMessage(null, src);
        Buffer buf=marshal(msg);
        System.out.println("buf = " + buf);

        int len=buf.getLength();
View Full Code Here

     * Current record: 102 (March 2010)
     * Prev: 161, 127, 121, 102
     * @throws Exception
     */
    public static void testUnicast() throws Exception {
        Address dest=Util.createRandomAddress();
        Address src=Util.createRandomAddress();
        Message msg=createMessage(dest, src);
        Buffer buf=marshal(msg);
        System.out.println("buf = " + buf);

        int len=buf.getLength();
View Full Code Here

    }

    private static Buffer marshal(Message msg) throws Exception {
        ExposedByteArrayOutputStream out_stream=new ExposedByteArrayOutputStream((int)(msg.size() + 50));
        ExposedDataOutputStream dos=new ExposedDataOutputStream(out_stream);
        Address dest=msg.getDest();
        boolean multicast=dest == null || dest.isMulticastAddress();
        writeMessage(msg, dos, multicast);
        return new Buffer(out_stream.getRawBuffer(), 0, out_stream.size());
    }
View Full Code Here

TOP

Related Classes of org.jgroups.Address

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.