Receiving the outgoing should be possible win WinPcap, but I don't know how to spoof incoming unless you find the address of the receiving function and call it from your program. None of this can be done from Java, as far as I know. Your best bet would probably be C#, since it's pretty similar.