/** Test of isValid method, of class RtpPacket. */
  @Test
  public void testDecode() {
    // These values are from wireshark trace
    RtcpAppDefined rtcpAppDefined = new RtcpAppDefined();
    int length = rtcpAppDefined.decode(p, 0);

    assertEquals(p.length, length);

    assertEquals(2, rtcpAppDefined.getVersion());
    assertFalse(rtcpAppDefined.isPadding());
    assertEquals(1, rtcpAppDefined.getCount()); // subtype

    assertEquals(RtcpCommonHeader.RTCP_APP, rtcpAppDefined.getPt());

    assertEquals(266283887, rtcpAppDefined.getSsrc());

    assertEquals("qtsi", rtcpAppDefined.getName());

    byte[] expected =
        new byte[] {
          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x61, 0x74, 0x00, 0x04, 0x00, 0x00, 0x00,
          0x14
        };
    java.util.Arrays.equals(expected, rtcpAppDefined.getData());
  }
  @Test
  public void testEncode() {

    byte[] appData =
        new byte[] {
          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x61, 0x74, 0x00, 0x04, 0x00, 0x00, 0x00,
          0x14
        };

    RtcpAppDefined rtcpAppDefined = new RtcpAppDefined(false, 1, 266283887, "qtsi", appData);

    byte[] rawData = new byte[256];

    int length = rtcpAppDefined.encode(rawData, 0);

    assertEquals(p.length, length);

    for (int i = 0; i < p.length; i++) {
      assertEquals(p[i], rawData[i]);
    }
  }