SourceForge Jpcap

net.sourceforge.jpcap.capture
Class CaptureTest

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

public class CaptureTest
extends Object
implements PacketListener, RawPacketListener

Class to exercise PacketCapture.

Testing of PacketCapture 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:52 $

Field Summary
protected static String Filter
           
protected static String NAME
           
protected static int TEST_COUNT
           
 
Constructor Summary
CaptureTest()
          Create a new tester.
 
Method Summary
static void main(String[] args)
          Simple test to exercise PacketCapture.
 void packetArrived(Packet packet)
          Callback, called when PacketCapture.capture(int) captures a packet.
 void rawPacketArrived(RawPacket rawPacket)
           
 void runTest()
          Execute the test.
 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

TEST_COUNT

protected static int TEST_COUNT

Filter

protected static String Filter
Constructor Detail

CaptureTest

public CaptureTest()
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
Parameters:
packet - Packet that has been captured.
See Also:
Object.clone()

rawPacketArrived

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

runTest

public void runTest()
Execute the test.


testDump

public void testDump()
              throws Exception
Throws:
Exception

main

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

Throws:
IOException

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