Search in sources :

Example 61 with IpAddress

use of org.jgroups.stack.IpAddress in project JGroups by belaban.

the class SizeTest method testIpAddress3.

public static void testIpAddress3() throws Exception {
    IpAddress addr = new IpAddress(5555, false);
    _testSize(addr);
}
Also used : IpAddress(org.jgroups.stack.IpAddress)

Example 62 with IpAddress

use of org.jgroups.stack.IpAddress in project JGroups by belaban.

the class SizeTest method testIpAddress1.

public static void testIpAddress1() throws Exception {
    IpAddress addr = new IpAddress("127.0.0.1", 5555);
    _testSize(addr);
}
Also used : IpAddress(org.jgroups.stack.IpAddress)

Example 63 with IpAddress

use of org.jgroups.stack.IpAddress in project JGroups by belaban.

the class SizeTest method testGossipData.

public void testGossipData() throws Exception {
    GossipData data;
    final Address own = org.jgroups.util.UUID.randomUUID();
    final Address coord = org.jgroups.util.UUID.randomUUID();
    NameCache.add(own, "own");
    NameCache.add(coord, "coord");
    PingData pd1 = new PingData(coord, true, "coord", new IpAddress(7400));
    PingData pd2 = new PingData(own, true, "own", new IpAddress(7500));
    final PhysicalAddress physical_addr_1 = new IpAddress("127.0.0.1", 7500);
    _testSize(new GossipData(GossipType.REGISTER));
    data = new GossipData(GossipType.REGISTER, "DemoCluster", own, (List<PingData>) null, null);
    _testSize(data);
    data = new GossipData(GossipType.REGISTER, "DemoCluster", own, Arrays.asList(pd1, pd2), null);
    _testSize(data);
    data = new GossipData(GossipType.REGISTER, "DemoCluster", own, Arrays.asList(pd2, pd1), physical_addr_1);
    _testSize(data);
    data = new GossipData(GossipType.REGISTER, "demo", own, "logical_name", null);
    _testSize(data);
    data = new GossipData(GossipType.REGISTER, "demo", own, new byte[] { 'b', 'e', 'l', 'a' });
    _testSize(data);
    byte[] buffer = new byte[10];
    buffer[2] = 'B';
    buffer[3] = 'e';
    buffer[4] = 'l';
    buffer[5] = 'a';
    data = new GossipData(GossipType.REGISTER, "demo", own, buffer, 2, 4);
    _testSize(data);
    buffer = "hello world".getBytes();
    data = new GossipData(GossipType.MESSAGE, "demo", null, buffer, 0, buffer.length);
    _testSize(data);
}
Also used : IpAddress(org.jgroups.stack.IpAddress) IpAddress(org.jgroups.stack.IpAddress) GossipData(org.jgroups.stack.GossipData)

Example 64 with IpAddress

use of org.jgroups.stack.IpAddress in project JGroups by belaban.

the class SizeTest method testAddressVector.

public static void testAddressVector() throws Exception {
    List<Address> v = new ArrayList<>();
    _testSize(v);
    v.add(new IpAddress(1111));
    _testSize(v);
    v.add(new IpAddress(2222));
    _testSize(v);
}
Also used : IpAddress(org.jgroups.stack.IpAddress) IpAddress(org.jgroups.stack.IpAddress)

Example 65 with IpAddress

use of org.jgroups.stack.IpAddress in project JGroups by belaban.

the class SizeTest method testWriteAddresses.

public static void testWriteAddresses() throws Exception {
    List<Address> list = new ArrayList<>();
    for (int i = 0; i < 3; i++) list.add(UUID.randomUUID());
    _testWriteAddresses(list);
    list.clear();
    list.add(new IpAddress(7500));
    list.add(new IpAddress("192.168.1.5", 4444));
    list.add(new IpAddress("127.0.0.1", 5674));
    _testWriteAddresses(list);
}
Also used : IpAddress(org.jgroups.stack.IpAddress) IpAddress(org.jgroups.stack.IpAddress)

Aggregations

IpAddress (org.jgroups.stack.IpAddress)68 InetSocketAddress (java.net.InetSocketAddress)12 Address (org.jgroups.Address)9 IpAddressUUID (org.jgroups.stack.IpAddressUUID)8 Event (org.jgroups.Event)6 ByteArrayDataOutputStream (org.jgroups.util.ByteArrayDataOutputStream)6 ByteArrayDataInputStream (org.jgroups.util.ByteArrayDataInputStream)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 DataInputStream (java.io.DataInputStream)4 DataOutputStream (java.io.DataOutputStream)4 InetAddress (java.net.InetAddress)4 PhysicalAddress (org.jgroups.PhysicalAddress)4 Test (org.testng.annotations.Test)4 UUID (org.jgroups.util.UUID)3 ServerSocket (java.net.ServerSocket)2 Socket (java.net.Socket)2 ByteBuffer (java.nio.ByteBuffer)2 ManagedOperation (org.jgroups.annotations.ManagedOperation)2 FixedMembershipToken (org.jgroups.auth.FixedMembershipToken)2