use of io.netty.handler.codec.http.HttpObject in project netty by netty.
the class RtspDecoderTest method testReceiveAnnounce.
/**
* There was a problem when an ANNOUNCE request was issued by the server,
* i.e. entered through the response decoder. First the decoder failed to
* parse the ANNOUNCE request, then it stopped receiving any more
* responses. This test verifies that the issue is solved.
*/
@Test
public void testReceiveAnnounce() {
byte[] data1 = ("ANNOUNCE rtsp://172.20.184.218:554/d3abaaa7-65f2-" + "42b4-8d6b-379f492fcf0f RTSP/1.0\r\n" + "CSeq: 2\r\n" + "Session: 2777476816092819869\r\n" + "x-notice: 5402 \"Session Terminated by Server\" " + "event-date=20150514T075303Z\r\n" + "Range: npt=0\r\n\r\n").getBytes();
byte[] data2 = ("RTSP/1.0 200 OK\r\n" + "Server: Orbit2x\r\n" + "CSeq: 172\r\n" + "Session: 2547019973447939919\r\n" + "\r\n").getBytes();
EmbeddedChannel ch = new EmbeddedChannel(new RtspDecoder(), new HttpObjectAggregator(1048576));
ch.writeInbound(Unpooled.wrappedBuffer(data1), Unpooled.wrappedBuffer(data2));
HttpObject res1 = ch.readInbound();
assertNotNull(res1);
assertTrue(res1 instanceof FullHttpRequest);
((FullHttpRequest) res1).release();
HttpObject res2 = ch.readInbound();
assertNotNull(res2);
assertTrue(res2 instanceof FullHttpResponse);
((FullHttpResponse) res2).release();
}
Aggregations