If UnicastRemoteObject is extended without specifying a server socket factory then the remote object is exported to the wildcard address. This bug requests that the specification for these methods be clarified to make it clear that the object is exported to all local addresses. The javadoc should also be updated to include an example that uses a server socket factory such as the following:
static class MyFactory implements RMIServerSocketFactory {
private final InetAddress addr;
MyFactory(InetAddress addr) {
this.addr = addr;
}
public ServerSocket createServerSocket(int port) throws IOException {
return new ServerSocket(port, 0, addr);
}
public int hashCode() {
return addr.hashCode();
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
} else if (obj == null || getClass() != obj.getClass()) {
return false;
}
MyFactory other = (MyFactory) obj;
return addr.equals(other.addr);
}
}