fix diskCache.canWrite to use nio2;
add unit tests