Adding testing support (Junit) and some basic mock and testing - trying to get code testable.

Add more detailed error handling for remote sync for fixing https://github.com/ajaxplorer/ajaxplorer-sync/issues/33 bug. Right now sync process affects accessed file again after error occuring.