There should be a way to create a Socket object based on a file descriptor such as stdin, so that you can write Java programs that are invoked by inetd.