Add abstract base class for NioSession, and apply necessary changes.