@Test public void readPacket() throws IOException{ reader = (IPacketReader) context.getBean("netmonPacketReader"); netmonreader = (NetmonPacketReaderImpl)reader; netmonreader.setNetmon(netmon); netmonreader.readPacket(file.getAbsolutePath(), listener); byte[] data = new byte[20]; netmonreader.receiveNetmonPacket(12, 1, 1, 1, data, "test"); netmonreader.receiveNetmonPacket(0xf000, 1, 1, 1, data, "test"); }
@Override public void readPacket(String packetfile, IPacketListener listener) throws IOException { if(netmon == null){ netmon = new NetmonAdapter(); netmon.loadNativeLibs(); } LOGGER.info("Creating Netmon Adapter..."); if (listener == null) { LOGGER.error("PacketListener cannot be null"); throw new IllegalArgumentException("PacketListener cannot be null"); } this.packetlistener = listener; int retval = netmon.parseTraceFile(packetfile); switch (retval) { case NETMON_PARSING_SUCCESS: return; case NETMON_TRACE_FILE_LOAD_ERROR: case NETMON_ERROR: default: LOGGER.error("NetMon error code: " + retval); throw new IOException("NetMon error code: " + retval); } }
NetmonPacketReaderImpl implements IPacketReader, INetmonPacketSubscriber { @Override public void readPacket(String packetfile, IPacketListener listener) throws IOException { if(netmon == null){ netmon = new NetmonAdapter(); netmon.loadNativeLibs(); } LOGGER.info("Creating Netmon Adapter..."); if (listener == null) { LOGGER.error("PacketListener cannot be null"); throw new IllegalArgumentException("PacketListener cannot be null"); } this.packetlistener = listener; int retval = netmon.parseTraceFile(packetfile); switch (retval) { case NETMON_PARSING_SUCCESS: return; case NETMON_TRACE_FILE_LOAD_ERROR: case NETMON_ERROR: default: LOGGER.error("NetMon error code: " + retval); throw new IOException("NetMon error code: " + retval); } } }
NetmonPacketReaderImpl implements IPacketReader, INetmonPacketSubscriber { @Override public void readPacket(String packetfile, IPacketListener listener) throws IOException { if(netmon == null){ netmon = new NetmonAdapter(); netmon.loadNativeLibs(); } LOGGER.info("Creating Netmon Adapter..."); if (listener == null) { LOGGER.error("PacketListener cannot be null"); throw new IllegalArgumentException("PacketListener cannot be null"); } this.packetlistener = listener; int retval = netmon.parseTraceFile(packetfile); switch (retval) { case NETMON_PARSING_SUCCESS: return; case NETMON_TRACE_FILE_LOAD_ERROR: case NETMON_ERROR: default: LOGGER.error("NetMon error code: " + retval); throw new IOException("NetMon error code: " + retval); } }  }
NetmonPacketReaderImpl implements IPacketReader, INetmonPacketSubscriber { @Override public void readPacket(String packetfile, IPacketListener listener) throws IOException { if(netmon == null){ netmon = new NetmonAdapter(); netmon.loadNativeLibs(); } LOGGER.info("Creating Netmon Adapter..."); if (listener == null) { LOGGER.error("PacketListener cannot be null"); throw new IllegalArgumentException("PacketListener cannot be null"); } this.packetlistener = listener; int retval = netmon.parseTraceFile(packetfile); switch (retval) { case NETMON_PARSING_SUCCESS: return; case NETMON_TRACE_FILE_LOAD_ERROR: case NETMON_ERROR: default: LOGGER.error("NetMon error code: " + retval); throw new IOException("NetMon error code: " + retval); } }  void setNetmon(NetmonAdapter netmon); @Override void readPacket(String packetfile, IPacketListener listener); @Override void receiveNetmonPacket(int datalink, long seconds,
			long microSeconds, int len, byte[] data, String appName); }
NetmonPacketReaderImpl implements IPacketReader, INetmonPacketSubscriber { @Override public void readPacket(String packetfile, IPacketListener listener) throws IOException { if(netmon == null){ netmon = new NetmonAdapter(); netmon.loadNativeLibs(); } LOGGER.info("Creating Netmon Adapter..."); if (listener == null) { LOGGER.error("PacketListener cannot be null"); throw new IllegalArgumentException("PacketListener cannot be null"); } this.packetlistener = listener; int retval = netmon.parseTraceFile(packetfile); switch (retval) { case NETMON_PARSING_SUCCESS: return; case NETMON_TRACE_FILE_LOAD_ERROR: case NETMON_ERROR: default: LOGGER.error("NetMon error code: " + retval); throw new IOException("NetMon error code: " + retval); } }  void setNetmon(NetmonAdapter netmon); @Override void readPacket(String packetfile, IPacketListener listener); @Override void receiveNetmonPacket(int datalink, long seconds,
			long microSeconds, int len, byte[] data, String appName); static final int NETMON_ERROR; static final int NETMON_TRACE_FILE_LOAD_ERROR; static final int NETMON_PARSING_SUCCESS; }