SourceForge Jpcap

net.sourceforge.jpcap.capture
Class JWinPcapTest

java.lang.Object
  extended by net.sourceforge.jpcap.capture.CaptureTest
      extended by net.sourceforge.jpcap.capture.JWinPcapTest
All Implemented Interfaces:
EventListener, PacketListener, RawPacketListener, StatisticsListener

public class JWinPcapTest
extends CaptureTest
implements PacketListener, RawPacketListener, StatisticsListener

Class to exercise JWinPcap.

Testing of JWinPcap could easily be implemented in the same class's main method, but since the tester is a client and must implement the listener interface, seems clearer to decouple the two.

Version:
$Revision: 1.1 $
Author:
Patrick Charles and Jonas Lehmann, Esmond Pitt
Last modified by:
$Author: esmondpitt $
Last modified at:
$Date: 2008/08/21 02:57:56 $

Field Summary
protected static String NAME
           
 
Fields inherited from class net.sourceforge.jpcap.capture.CaptureTest
Filter, TEST_COUNT
 
Constructor Summary
JWinPcapTest()
          Create a new tester.
 
Method Summary
static void main(String[] args)
          Simple test to exercise JWinPcap.
 void packetArrived(Packet packet)
          Callback, called when PacketCapture.capture(int) captures a packet.
 void rawPacketArrived(RawPacket rawPacket)
           
 void runTest()
          Execute the test.
 void statisticsArrived(StatisticsEvent event)
          Handle a statistics event.
 void testDump()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

protected static String NAME
Constructor Detail

JWinPcapTest

public JWinPcapTest()
Create a new tester.

Method Detail

packetArrived

public void packetArrived(Packet packet)
Description copied from interface: PacketListener
Callback, called when PacketCapture.capture(int) captures a packet.

Specified by:
packetArrived in interface PacketListener
Overrides:
packetArrived in class CaptureTest
Parameters:
packet - Packet that has been captured.
See Also:
Object.clone()

rawPacketArrived

public void rawPacketArrived(RawPacket rawPacket)
Specified by:
rawPacketArrived in interface RawPacketListener
Overrides:
rawPacketArrived in class CaptureTest

statisticsArrived

public void statisticsArrived(StatisticsEvent event)
Description copied from interface: StatisticsListener
Handle a statistics event.

Specified by:
statisticsArrived in interface StatisticsListener
Parameters:
event - StatisticsEvent

runTest

public void runTest()
Execute the test.

Overrides:
runTest in class CaptureTest

testDump

public void testDump()
              throws Exception
Overrides:
testDump in class CaptureTest
Throws:
Exception

main

public static void main(String[] args)
                 throws IOException
Simple test to exercise JWinPcap.

Throws:
IOException

Copyright © Patrick Charles & Jonas Lehmann, 2001; Esmond Pitt, 2008.