Ive never tried it, but id assume it would involve launching external executables, and not pure java.
Since this doesnt sound like a common problem, i dont think it would be part of any api.
In windows, with dialup, the os generally attempts to connect automatically, and disconnect after inactivity.
Im sure its possible though. Dont listen to me too seriously, its just my take on the situation;)