コード例 #1
0
  @Test
  public void testUdpPort() throws Exception {
    byte[] md1 = m1.getData();
    byte[] md2 = m2.getData();

    MemberImpl a1 = MemberImpl.getMember(md1);
    MemberImpl a2 = MemberImpl.getMember(md2);

    assertTrue(a1.getUdpPort() == a2.getUdpPort());
    assertTrue(a1.getUdpPort() == udpPort);
  }
コード例 #2
0
  @Test
  public void testSerializationOne() throws Exception {
    MemberImpl m = m1;
    byte[] md1 = m.getData(false, true);
    byte[] mda1 = m.getData(false, false);
    assertTrue(Arrays.equals(md1, mda1));
    assertTrue(md1 == mda1);
    mda1 = m.getData(true, true);
    MemberImpl ma1 = MemberImpl.getMember(mda1);
    assertTrue(compareMembers(m, ma1));
    mda1 = p1.getData(false);
    assertFalse(Arrays.equals(md1, mda1));
    ma1 = MemberImpl.getMember(mda1);
    assertTrue(compareMembers(p1, ma1));

    md1 = m.getData(true, true);
    Thread.sleep(50);
    mda1 = m.getData(true, true);
    MemberImpl a1 = MemberImpl.getMember(md1);
    MemberImpl a2 = MemberImpl.getMember(mda1);
    assertTrue(a1.equals(a2));
    assertFalse(Arrays.equals(md1, mda1));
  }