SllFramer implements Framer<PCapPacket, MACPacket> { @Override public MACPacket frame(final PCapPacket parent, final Buffer buffer) throws IOException { if (parent == null) { throw new IllegalArgumentException("The parent frame cannot be null"); } final Buffer headers = buffer.readBytes(16); final Buffer payload = buffer.slice(buffer.capacity()); return new MACPacketImpl(Protocol.SLL, parent, headers, payload); } SllFramer(); @Override Protocol getProtocol(); @Override MACPacket frame(final PCapPacket parent, final Buffer buffer); @Override boolean accept(final Buffer buffer);  }
@Test public void testFrame() throws Exception { final SllFramer framer = new SllFramer(); final Buffer buffer = Buffers.wrap(RawData.rawSLLFrame); assertThat(framer.accept(buffer), is(true)); final MACPacket pkt = framer.frame(mock(PCapPacket.class), buffer); assertThat(pkt.getSourceMacAddress(), is("12:31:38:1B:7B:73")); assertThat(pkt.getDestinationMacAddress(), is("00:04:00:01:00:06")); final Packet ipFrame = pkt.getNextPacket(); assertThat(ipFrame.getProtocol(), is(Protocol.IPv4)); final Packet sipFrame = pkt.getPacket(Protocol.SIP); assertThat(sipFrame, not((Packet) null)); assertThat(sipFrame.getProtocol(), is(Protocol.SIP)); final SipPacket msg = (SipPacket) sipFrame; assertThat(msg.getMethod().toString(), is("INVITE")); }