Search in sources :

Example 1 with UnicastHeader3

use of org.jgroups.protocols.UnicastHeader3 in project JGroups by belaban.

the class MessageBeforeConnectedTestHelper method sendUnicast.

/**
 * Sends a unicast message up UNICAST2. Do *NOT* make this method static, or Byteman will not find it!
 */
public void sendUnicast(JChannel ch) throws Exception {
    final Message msg = new BytesMessage(ch.getAddress(), "hello-1").setSrc(ch.getAddress());
    // Add a UNICAST2 header
    final UNICAST3 unicast = ch.getProtocolStack().findProtocol(UNICAST3.class);
    UnicastHeader3 hdr = UnicastHeader3.createDataHeader(1, (short) 1, true);
    msg.putHeader(unicast.getId(), hdr);
    new Thread(() -> unicast.down(msg)).start();
}
Also used : BytesMessage(org.jgroups.BytesMessage) Message(org.jgroups.Message) BytesMessage(org.jgroups.BytesMessage) UNICAST3(org.jgroups.protocols.UNICAST3) UnicastHeader3(org.jgroups.protocols.UnicastHeader3)

Aggregations

BytesMessage (org.jgroups.BytesMessage)1 Message (org.jgroups.Message)1 UNICAST3 (org.jgroups.protocols.UNICAST3)1 UnicastHeader3 (org.jgroups.protocols.UnicastHeader3)1