SipInitialLine extends SipParser { public static boolean isResponseLine(final Buffer buffer) throws IOException { if (buffer == null || buffer.getReadableBytes() < 7) { return false; } final byte a = buffer.getByte(0); final byte b = buffer.getByte(1); final byte c = buffer.getByte(2); final byte d = buffer.getByte(3); final byte e = buffer.getByte(4); final byte f = buffer.getByte(5); final byte g = buffer.getByte(6); return a == 'S' && b == 'I' && c == 'P' && d == '/' && e == '2' && f == '.' && g == '0'; } protected  SipInitialLine(); abstract boolean equals(final Object other); abstract Buffer getBuffer(); static boolean isResponseLine(final Buffer buffer); static final SipInitialLine parse(final Buffer buffer); static final SipInitialLine parse(final Buffer part1, final Buffer part2, final Buffer part3); SipRequestLine toRequestLine(); SipResponseLine toResponseLine(); boolean isResponseLine(); boolean isRequestLine(); abstract void getBytes(Buffer dst);  }
@Test public void testIsResponseLine() throws Exception { assertThat(SipInitialLine.isResponseLine(Buffers.wrap("SIP")), is(false)); assertThat(SipInitialLine.isResponseLine(Buffers.wrap("sIP")), is(false)); assertThat(SipInitialLine.isResponseLine(Buffers.wrap("SIP/2.0")), is(true)); assertThat(SipInitialLine.isResponseLine(Buffers.wrap("SIP/2.0 ahhhhh")), is(true)); assertThat(SipInitialLine.isResponseLine(Buffers.wrap("hello")), is(false)); assertThat(SipInitialLine.isResponseLine(null), is(false)); assertThat(SipInitialLine.isResponseLine(Buffers.wrap("sip/2.0")), is(false)); }