The stub class solves this problem redefining the method
finalize
(this is called finalization in Java).
The local garbage collector will invoke it automatically when it detects
that the stub is no longer reachable (at most once).
Server and client connection solved this bug by resetting the object streams after executing a remote invocation.
To simplify this problem the number of classes with objects that can be invoked concurrently was minimized (only the manager, server connections and client connections are invoked concurrently).