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;
}
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());
}
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;
}
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);
}
}
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;
}
Aggregations