Exemplo n.º 1
0
  @Test
  public void testMessage() throws Exception {
    failed = false;

    speaker1.send("MyUDPTopic", new MyMessage(MESSAGE + "1"));
    MyMessage m = queue.poll(2000l, TimeUnit.MILLISECONDS);
    assertNotNull(m);
    assertEquals(m.getMessage(), MESSAGE + "1");

    if (failed) {
      fail();
    }

    speaker1.send("BadTopic", new MyMessage(MESSAGE + "2"));
    m = queue.poll(500l, TimeUnit.MILLISECONDS);
    assertNull(m);

    queue.clear();

    speaker2.send("MyUDPTopic", new MyMessage(MESSAGE + "1"));
    m = queue.poll(2000l, TimeUnit.MILLISECONDS);
    assertNotNull(m);
    assertEquals(m.getMessage(), MESSAGE + "1");

    if (failed) {
      fail();
    }

    speaker2.send("BadTopic", new MyMessage(MESSAGE + "2"));
    m = queue.poll(500l, TimeUnit.MILLISECONDS);
    assertNull(m);

    queue.clear();
  }
Exemplo n.º 2
0
  @AfterClass
  public static void shutdown() throws InterruptedException {
    speaker1.shutdown();
    speaker2.shutdown();

    Thread.sleep(1000l);

    Parameters.INSTANCE.setProperty(ClusterService.PROTOCOL_PROPERTY, "tcp");
    Parameters.INSTANCE.setProperty(MeMember.ENCRYPTION_PROPERTY, "false");
  }
Exemplo n.º 3
0
  @BeforeClass
  public static void init() throws InterruptedException {
    Parameters.INSTANCE.setProperty(ClusterService.PROTOCOL_PROPERTY, "udp");
    Parameters.INSTANCE.setProperty(MeMember.ENCRYPTION_PROPERTY, "true");

    speaker1 = BigIO.bootstrap();
    speaker2 = BigIO.bootstrap();

    speaker2.addListener("MyUDPTopic", listener);

    Thread.sleep(1000l);
  }