Handles all I/O events on a socket connection.
<p> A handle which represents connection between two end-points regardless of transport types. </p> <p> {@link Connection} provides user-defined attributes. User-defined attributes are application-specific data which are associated with a connection. It often contains objects that represents the state of a higher-level protocol and becomes a way to exchange data between filters and handlers. </p> <h3>Adjusting Transport Type Specific Properties</h3> <p> You can simply downcast the connection to an appropriate subclass. </p> <h3>Thread Safety</h3> <p> {@link Connection} is thread-safe. But please note that performing more than one {@link #write(Object)} calls at the same time will cause the {@link IoFilter#filterWrite(IoFilter.NextFilter,Connection,WriteRequest)} to be executed simultaneously, and therefore you have to make sure the {@link IoFilter} implementations you're using are thread-safe, too. </p> <h3>Equality of Connections</h3> TODO : The getId() method is totally wrong. We can't base a method which is designed to create a unique ID on the hashCode method. {@link Object#equals(Object)} and {@link Object#hashCode()} shall not be overriden to the default behavior that is defined in {@link Object}.