### Question:
RtspResponseHeader extends RtspHeader { public static RtspResponseHeader parse(String[] headerLines) throws ParseException, RtspException { Matcher m = responsePattern.matcher(headerLines[0]); if (!m.find()) throw new ParseException("not a valid request line", 0); if (!m.group(1).equalsIgnoreCase("RTSP")) throw new ParseException("unsupported protocol: " + m.group(3), 0); if (!m.group(2).matches("1.0")) throw new RtspException(505, "unsupported RTSP version: " + m.group(4), 0); RtspResponseHeader result = new RtspResponseHeader(Integer.parseInt(m.group(3)), m.group(4)); for (int i = 1; i < headerLines.length; i++) { StringBuilder fieldLine = new StringBuilder(headerLines[i]); while (++i < headerLines.length) { if (headerLines[i].length() > 0 && !Character.isWhitespace(headerLines[i].charAt(0))) break; fieldLine.append(headerLines[i].trim()); } Field field = Field.parse(fieldLine.toString()); if (field != null) result.addField(field); i--; } return result; } protected  RtspResponseHeader(int code, String message);  RtspResponseHeader(int code, String message, int cseq); int getCode(); void setCode(int code); String getMessage(); void setMessage(String message); @Override String toString(); static RtspResponseHeader parse(String[] headerLines);  }### Answer:
@Test public void testParse() throws Exception { System.out.println("RTSP message response header parse test..."); String[][] lines = new String[][] { { "RTSP/1.0 200 OK", "CSeq: 1", "Transport:RTP/AVP;", " unicast;client_port=5000" }, { "test" }, { "RTP/1.0 200 OK" }, { "RTSP/2.0 200 OK" }, }; int i = 0; RtspResponseHeader rh = RtspResponseHeader.parse(lines[i++]); assertEquals(200, rh.getCode()); assertEquals("OK", rh.getMessage()); assertEquals(1, rh.getCSeq()); TransportField tf = (TransportField)rh.getField("transport"); assertEquals(5000, (int)tf.getClientPortFrom()); for (; i < lines.length; i++) { try { RtspResponseHeader.parse(lines[i]); fail("response header: \"" + Arrays.toString(lines[i]) + "\" parsed without an exception"); } catch (ParseException ex) { } catch (RtspException ex) { } } }