When you use certain technologies such as RMI (Remote Method Invocation), it's tougher to deal with firewalls. RMI normally listens for connections on any free port, so you end up having to open up all ports on the firewall over 1024. If you want to open just one port on the firewall, you can create a relay program that accepts a hostname and port number and then connects to the named host and port.
It's extremely dangerous to make a relay that allows users outside the firewall to make connections to any address inside the firewall. You have essentially turned off the firewall and opened up your network to the world. You must limit the hosts and ports that you allow the user to connect to.
Although the relay ...