Internet Emulation for Java Applications through Socket Factories