Search in sources :

Example 71 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class SYM_ENCRYPT_Test method create.

protected JChannel create(String name) throws Exception {
    JChannel ch = new JChannel(Util.getTestStack()).name(name);
    SYM_ENCRYPT encrypt;
    try {
        encrypt = createENCRYPT("keystore/defaultStore.keystore", DEF_PWD);
    } catch (Throwable t) {
        encrypt = createENCRYPT("defaultStore.keystore", DEF_PWD);
    }
    ch.getProtocolStack().insertProtocol(encrypt, ProtocolStack.Position.BELOW, NAKACK2.class);
    return ch;
}
Also used : JChannel(org.jgroups.JChannel)

Example 72 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class UNICAST_DropFirstAndLastTest method testFirstMessageDropped.

/**
 * A sends unicast message 1 to B, but we drop message 1. The code in
 * https://issues.jboss.org/browse/JGRP-1563 now needs to make sure message 1 is retransmitted to B
 * within a short time period, and we don't have to rely on the stable task to kick in.
 */
@Test(dataProvider = "configProvider")
public void testFirstMessageDropped(Class<? extends Protocol> unicast_class) throws Exception {
    setup(unicast_class);
    System.out.println("**** closing all connections ****");
    // close all connections, so we can start from scratch and send message A1 to B
    for (JChannel ch : Arrays.asList(a, b)) {
        Protocol unicast = ch.getProtocolStack().findProtocol(Util.getUnicastProtocols());
        removeAllConnections(unicast);
    }
    setLevel("trace", a, b);
    System.out.println("--> A sending first message to B (dropped before it reaches B)");
    // drops the next unicast
    discard.setDropDownUnicasts(1);
    a.send(new Message(b.getAddress(), 1));
    List<Integer> msgs = rb.list();
    try {
        Util.waitUntilListHasSize(msgs, 1, 500000, 500);
    } catch (AssertionError err) {
        printConnectionTables(a, b);
        throw err;
    }
    System.out.println("list=" + msgs);
    printConnectionTables(a, b);
// assert ((UNICAST2)a.getProtocolStack().findProtocol(UNICAST2.class)).connectionEstablished(b.getAddress());
}
Also used : JChannel(org.jgroups.JChannel) Message(org.jgroups.Message) Protocol(org.jgroups.stack.Protocol) Test(org.testng.annotations.Test)

Example 73 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class FdMonitorTest method createChannel.

protected JChannel createChannel(String name) throws Exception {
    JChannel ch = new JChannel(new SHARED_LOOPBACK(), new SHARED_LOOPBACK_PING(), new FD().setValue("timeout", 1000).setValue("max_tries", 3), new NAKACK2(), new UNICAST3(), new GMS().setValue("print_local_addr", false)).name(name);
    ch.setName(name);
    return ch;
}
Also used : NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) JChannel(org.jgroups.JChannel) GMS(org.jgroups.protocols.pbcast.GMS)

Example 74 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class AUTHTest method testJoinOfSecondNodeWithoutAuthHeader.

public void testJoinOfSecondNodeWithoutAuthHeader() throws Exception {
    JChannel a = create("A", true), b = create("B", false);
    a.connect("auth-test");
    try {
        b.connect("auth-test");
        assert false : "the second member's JOIN should have thrown an exception";
    } catch (Exception ex) {
        System.out.printf("received exception as expected: %s\n", ex.getCause());
    } finally {
        Util.close(b, a);
    }
}
Also used : JChannel(org.jgroups.JChannel)

Example 75 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class AUTHTest method create.

protected JChannel create(String name, boolean create_auth_prot) throws Exception {
    JChannel ch = new JChannel(Util.getTestStack()).name(name);
    if (create_auth_prot) {
        // .setAuthCoord(false)
        AUTH auth = new AUTH().setAuthToken(new SimpleToken("foo"));
        ch.getProtocolStack().insertProtocol(auth, ProtocolStack.Position.BELOW, GMS.class);
    }
    return ch;
}
Also used : JChannel(org.jgroups.JChannel) SimpleToken(org.jgroups.auth.SimpleToken)

Aggregations

JChannel (org.jgroups.JChannel)119 GMS (org.jgroups.protocols.pbcast.GMS)22 NAKACK2 (org.jgroups.protocols.pbcast.NAKACK2)21 Protocol (org.jgroups.stack.Protocol)18 STABLE (org.jgroups.protocols.pbcast.STABLE)15 View (org.jgroups.View)14 Message (org.jgroups.Message)10 ArrayList (java.util.ArrayList)9 Address (org.jgroups.Address)7 IOException (java.io.IOException)6 Test (org.testng.annotations.Test)5 InetSocketAddress (java.net.InetSocketAddress)4 HashMap (java.util.HashMap)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 DistributedSystemDisconnectedException (org.apache.geode.distributed.DistributedSystemDisconnectedException)4 LockService (org.jgroups.blocks.locking.LockService)4 Test (org.junit.Test)4 BeforeMethod (org.testng.annotations.BeforeMethod)4 CountDownLatch (java.util.concurrent.CountDownLatch)3 ChannelBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory)3