Change access permissions and consolidate error handling in nio2