Package org.jgroups.stack

Examples of org.jgroups.stack.IpAddress


        IpAddress addr=new IpAddress(3456);
        _testSize(addr);
    }

    public void testIpAddress3() throws Exception {
        IpAddress addr=new IpAddress(5555, false);
        _testSize(addr);
    }
View Full Code Here


        IpAddress addr=new IpAddress(5555, false);
        _testSize(addr);
    }

    public void testIpAddressWithAdditionalData() throws Exception {
        IpAddress addr=new IpAddress(5555, false);
        addr.setAdditionalData("bela".getBytes());
        _testSize(addr);
    }
View Full Code Here

        hdr=new RequestCorrelator.Header(RequestCorrelator.Header.REQ, 322649, false, "HelloWorld");
        _testSize(hdr);

        hdr=new RequestCorrelator.Header(RequestCorrelator.Header.RSP, 322649, true, "bla");
        java.util.List l=new LinkedList();
        l.add(new IpAddress(1111));
        l.add(new IpAddress(2222));
        hdr.dest_mbrs=l;
        hdr.callStack=new Stack();
        hdr.callStack.push(new IpAddress(2222));
        hdr.callStack.push(new IpAddress(3333));
        _testSize(hdr);

        hdr=new RequestCorrelator.Header(RequestCorrelator.Header.RSP, 322649, true, "bla");
        hdr.callStack=new Stack();
        hdr.callStack.push(new IpAddress(2222));
        hdr.callStack.push(new IpAddress(3333));

        ByteArrayOutputStream output=new ByteArrayOutputStream();
        DataOutputStream out=new DataOutputStream(output);
        hdr.writeTo(out);
        out.flush();

        byte[] buf=output.toByteArray();
        out.close();

        ByteArrayInputStream input=new ByteArrayInputStream(buf);
        DataInputStream in=new DataInputStream(input);

        hdr=new RequestCorrelator.Header();
        hdr.readFrom(in);
        System.out.println("call stack is " + hdr.callStack);

        Address tmp=(Address)hdr.callStack.pop();
        assertEquals(tmp, new IpAddress(3333));
        tmp=(Address)hdr.callStack.pop();
        assertEquals(tmp, new IpAddress(2222));
        assertEquals(322649, hdr.id);
        assertTrue(hdr.rsp_expected);
        assertEquals("bla", hdr.corrName);
        assertEquals(hdr.type, RequestCorrelator.Header.RSP);
    }
View Full Code Here

        _testSize(si);

        si=new ServiceInfo(ServiceInfo.STATE_REQ, "bla", null, null);
        _testSize(si);

        si=new ServiceInfo(ServiceInfo.STATE_REQ, null, new IpAddress(3333), null);
        _testSize(si);

        si=new ServiceInfo(ServiceInfo.STATE_REQ, null, null, new byte[]{'b', 'e', 'l', 'a'});
        _testSize(si);

        si=new ServiceInfo(ServiceInfo.STATE_REQ, "bla", new IpAddress(3333), new byte[]{'b', 'e', 'l', 'a'});
        _testSize(si);
    }
View Full Code Here

        _testSize(new MuxHeader(si));

        si=new ServiceInfo(ServiceInfo.STATE_REQ, "bla", null, null);
        _testSize(new MuxHeader(si));

        si=new ServiceInfo(ServiceInfo.STATE_REQ, null, new IpAddress(3333), null);
        _testSize(new MuxHeader(si));

        si=new ServiceInfo(ServiceInfo.STATE_REQ, null, null, new byte[]{'b', 'e', 'l', 'a'});
        _testSize(new MuxHeader(si));

        si=new ServiceInfo(ServiceInfo.STATE_REQ, "bla", new IpAddress(3333), new byte[]{'b', 'e', 'l', 'a'});
        _testSize(new MuxHeader(si));
    }
View Full Code Here


        ClassConfigurator.getInstance(true);
        long start=System.currentTimeMillis();
        for(int i=0; i < num; i++) {
            Message m=new Message(new IpAddress(addr, 5555), new IpAddress(addr, 6666), new byte[1000]);
            if(add_headers)
                addHeaders(m);

            ExposedByteArrayOutputStream msg_data=new ExposedByteArrayOutputStream();
            Buffer jgbuf;
View Full Code Here

                    break;
                if(line.startsWith("conns")) {
                    System.out.println(ct);
                    continue;
                }
                dest=new IpAddress(dst_host, dst_port);
                data=line.getBytes();
                ct.send(dest, data, 0, data.length);
            }
            catch(Exception e) {
                System.err.println(e);
View Full Code Here

    }


    public void testObjectToFromByteBuffer() throws Exception {
        byte[] buf;
        IpAddress addr=new IpAddress("localhost", 5000), addr2;
        List list=new ArrayList(), list2;
        list.add("Bela");
        list.add("Jeannette");

        buf=Util.objectToByteBuffer(addr);
View Full Code Here


    public void testWriteStreamable() throws IOException, IllegalAccessException, InstantiationException {
        Message m=new Message(null, null, "Hello");
        ViewId vid=new ViewId(null, 12345);
        ViewId vid2=new ViewId(new IpAddress("127.0.0.1", 5555), 35623);
        ByteArrayOutputStream outstream=new ByteArrayOutputStream();
        DataOutputStream dos=new DataOutputStream(outstream);
        Util.writeGenericStreamable(m, dos);
        Util.writeGenericStreamable(vid, dos);
        Util.writeGenericStreamable(vid2, dos);
View Full Code Here

    public void testWriteView() throws IOException, IllegalAccessException, InstantiationException {
        ViewId vid=new ViewId(null, 12345);
        Vector members=new Vector();
        View v;
        IpAddress a1=new IpAddress("localhost", 1234);
        IpAddress a2=new IpAddress("127.0.0.1", 4444);
        IpAddress a4=new IpAddress("www.google.com", 7777);
        members.add(a1);
        members.add(a2);
        members.add(a4);
        v=new View(vid, members);
View Full Code Here

TOP

Related Classes of org.jgroups.stack.IpAddress

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.