I would like to send a captured packet sniffed from network device 1 and will inject it to network device 2 without altering its contents (will act as a wire)
So far I have tried
byte[] buf = new byte[packet.getTotalSize()];
System.out.println(packet); // packet is the captured/sniffed packet
System.out.println(packet.transferStateAndDataTo(buf));//packet contents to buffer
ByteBuffer b = ByteBuffer.wrap(buf);
Injector injector = new Injector(b); //Injector contains the pcap.sendPacket(b) method
injector.run();