Home / Class/ RtspEncoderTest Class — netty Architecture

RtspEncoderTest Class — netty Architecture

Architecture documentation for the RtspEncoderTest class in RtspEncoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5a20be0b_00db_ad17_3f71_aa64a206ddc3["RtspEncoderTest"]
  c2ec317f_45ef_da4b_394c_dbdb4e5a8ea8["RtspEncoderTest.java"]
  5a20be0b_00db_ad17_3f71_aa64a206ddc3 -->|defined in| c2ec317f_45ef_da4b_394c_dbdb4e5a8ea8
  0adce2d9_dcbf_57c1_3f82_683e4c5f39e4["testSendSetupRequest()"]
  5a20be0b_00db_ad17_3f71_aa64a206ddc3 -->|method| 0adce2d9_dcbf_57c1_3f82_683e4c5f39e4
  c30e9364_be2b_17f7_5271_c2c01dfd6751["testSendGetParameterRequest()"]
  5a20be0b_00db_ad17_3f71_aa64a206ddc3 -->|method| c30e9364_be2b_17f7_5271_c2c01dfd6751
  8de6bc77_d6e7_3011_3da2_b4933968fc33["testSend200OkResponseWithoutBody()"]
  5a20be0b_00db_ad17_3f71_aa64a206ddc3 -->|method| 8de6bc77_d6e7_3011_3da2_b4933968fc33
  a4064da9_b0fe_49af_2408_d3ecb344dc0f["testSend200OkResponseWithBody()"]
  5a20be0b_00db_ad17_3f71_aa64a206ddc3 -->|method| a4064da9_b0fe_49af_2408_d3ecb344dc0f

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/rtsp/RtspEncoderTest.java lines 36–173

public class RtspEncoderTest {

    /**
     * Test of a SETUP request, with no body.
     */
    @Test
    public void testSendSetupRequest() {
        String expected = "SETUP rtsp://172.10.20.30:554/d3abaaa7-65f2-42b4-"
                        + "8d6b-379f492fcf0f RTSP/1.0\r\n"
                        + "transport: MP2T/DVBC/UDP;unicast;client=01234567;"
                        + "source=172.10.20.30;"
                        + "destination=1.1.1.1;client_port=6922\r\n"
                        + "cseq: 1\r\n"
                        + "\r\n";

        HttpRequest request = new DefaultHttpRequest(RtspVersions.RTSP_1_0,
               RtspMethods.SETUP,
               "rtsp://172.10.20.30:554/d3abaaa7-65f2-42b4-8d6b-379f492fcf0f");
        request.headers().add(RtspHeaderNames.TRANSPORT,
               "MP2T/DVBC/UDP;unicast;client=01234567;source=172.10.20.30;" +
               "destination=1.1.1.1;client_port=6922");
        request.headers().add(RtspHeaderNames.CSEQ, "1");

        EmbeddedChannel ch = new EmbeddedChannel(new RtspEncoder());
        ch.writeOutbound(request);

        ByteBuf buf = ch.readOutbound();
        String actual = buf.toString(CharsetUtil.UTF_8);
        buf.release();
        assertEquals(expected, actual);
    }

    /**
     * Test of a GET_PARAMETER request, with body.
     */
    @Test
    public void testSendGetParameterRequest() {
        String expected = "GET_PARAMETER rtsp://172.10.20.30:554 RTSP/1.0\r\n"
                        + "session: 2547019973447939919\r\n"
                        + "cseq: 3\r\n"
                        + "content-length: 31\r\n"
                        + "content-type: text/parameters\r\n"
                        + "\r\n"
                        + "stream_state\r\n"
                        + "position\r\n"
                        + "scale\r\n";

        byte[] content = ("stream_state\r\n"
                        + "position\r\n"
                        + "scale\r\n").getBytes(CharsetUtil.UTF_8);

        FullHttpRequest request = new DefaultFullHttpRequest(
                RtspVersions.RTSP_1_0,
                RtspMethods.GET_PARAMETER,
                "rtsp://172.10.20.30:554");
        request.headers().add(RtspHeaderNames.SESSION, "2547019973447939919");
        request.headers().add(RtspHeaderNames.CSEQ, "3");
        request.headers().add(RtspHeaderNames.CONTENT_LENGTH,
                "" + content.length);
        request.headers().add(RtspHeaderNames.CONTENT_TYPE, "text/parameters");
        request.content().writeBytes(content);

        EmbeddedChannel ch = new EmbeddedChannel(new RtspEncoder());
        ch.writeOutbound(request);

        ByteBuf buf = ch.readOutbound();
        String actual = buf.toString(CharsetUtil.UTF_8);
        buf.release();
        assertEquals(expected, actual);
    }

    /**
     * Test of a 200 OK response, without body.
     */
    @Test
    public void testSend200OkResponseWithoutBody() {
        String expected = "RTSP/1.0 200 OK\r\n"
                        + "server: Testserver\r\n"
                        + "cseq: 1\r\n"
                        + "session: 2547019973447939919\r\n"
                        + "\r\n";

Frequently Asked Questions

What is the RtspEncoderTest class?
RtspEncoderTest is a class in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/rtsp/RtspEncoderTest.java.
Where is RtspEncoderTest defined?
RtspEncoderTest is defined in codec-http/src/test/java/io/netty/handler/codec/rtsp/RtspEncoderTest.java at line 36.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free