### Question:
SessionField extends RtspHeader.Field { public static SessionField parse(String fieldValue) throws ParseException { Matcher m = parsePattern.matcher(fieldValue); if (!m.find()) throw new ParseException("not a valid session field", 0); SessionField result = new SessionField(m.group(1)); String tmp = m.group(3); if (tmp != null && tmp.length() > 0) { try { result.setTimeout(Long.parseLong(tmp)); } catch (Exception ex) { throw (ParseException) new ParseException("not a valid session field", 0).initCause(ex); } } return result; } SessionField(String id, Long timeout);  SessionField(String id); String getId(); void setId(String id); Long getTimeout(); void setTimeout(Long timeout); @Override String getValueText(); @Override SessionField clone(); static SessionField parse(String fieldValue);  }### Answer:
@Test public void testParse() throws ParseException { System.out.println("RTSP message Session field parse test..."); String[] sfs = new String[] { "Session:abcd123;timeout=100", "Session: abcd123;timeout=100", "session: abcd123;timeout=100", "Session: abcd123", "Session: abcd123,timeout=100", "Session: abcd123;tout=100", "Session:" }; int i = 0; SessionField sf; for (; i < 3; i++) { sf = (SessionField)RtspHeader.Field.parse(sfs[i]); assertEquals("abcd123", sf.getId()); assertNotNull(sf.getTimeout()); assertEquals(100l, (long)sf.getTimeout()); } sf = (SessionField)RtspHeader.Field.parse(sfs[i++]); assertNull(sf.getTimeout()); sf = (SessionField)RtspHeader.Field.parse(sfs[i++]); assertEquals("abcd123,timeout=100", sf.getId()); assertNull(sf.getTimeout()); for (; i < sfs.length; i++) { try { RtspHeader.Field.parse(sfs[i]); fail("Session field: \"" + sfs[i] + "\" parsed without an exception"); } catch (ParseException ex) { } } }