PcapHandle implements Closeable { public Timestamp getTimestamp() { return timestamps.get(); } PcapHandle(Pointer handle, TimestampPrecision timestampPrecision); private  PcapHandle(Builder builder); DataLinkType getDlt(); void setDlt(DataLinkType dlt); boolean isOpen(); String getFilteringExpression(); TimestampPrecision getTimestampPrecision(); void setDirection(PcapDirection direction); Timestamp getTimestamp(); Integer getOriginalLength(); int getSnapshot(); SwappedType isSwapped(); int getMajorVersion(); int getMinorVersion(); BpfProgram compileFilter(String bpfExpression, BpfCompileMode mode, Inet4Address netmask); void setFilter(String bpfExpression, BpfCompileMode mode, Inet4Address netmask); void setFilter(String bpfExpression, BpfCompileMode mode); void setFilter(BpfProgram prog); void setBlockingMode(BlockingMode mode); BlockingMode getBlockingMode(); Packet getNextPacket(); byte[] getNextRawPacket(); Packet getNextPacketEx(); byte[] getNextRawPacketEx(); void loop(int packetCount, PacketListener listener); void loop(int packetCount, PacketListener listener, Executor executor); void loop(int packetCount, RawPacketListener listener); void loop(int packetCount, RawPacketListener listener, Executor executor); int dispatch(int packetCount, PacketListener listener); int dispatch(int packetCount, PacketListener listener, Executor executor); int dispatch(int packetCount, RawPacketListener listener); int dispatch(int packetCount, RawPacketListener listener, Executor executor); PcapDumper dumpOpen(String filePath); void loop(int packetCount, PcapDumper dumper); void breakLoop(); void sendPacket(Packet packet); void sendPacket(byte[] bytes); void sendPacket(byte[] bytes, int len); PcapStat getStats(); List<DataLinkType> listDatalinks(); String getError(); @Override void close(); @Override String toString(); static final Inet4Address PCAP_NETMASK_UNKNOWN; }
@Test public void testGetTimestamp() throws Exception { assertNull(ph.getTimestamp()); ph.getNextPacket(); assertEquals(1434220771517L, ph.getTimestamp().getTime()); }