use of java.net.ResponseCache in project enroscar by stanfy.
the class ResponseCacheSwitcher method saveUrlConnection.
public static void saveUrlConnection(final URLConnection connection) {
final ResponseCache cache = ResponseCache.getDefault();
if (!(cache instanceof ResponseCacheSwitcher)) {
return;
}
final ResponseCacheSwitcher hub = (ResponseCacheSwitcher) cache;
LinkedList<URLConnection> stack = hub.currentUrlConnection.get();
if (stack == null) {
stack = new LinkedList<URLConnection>();
hub.currentUrlConnection.set(stack);
}
stack.addFirst(connection);
}
use of java.net.ResponseCache in project enroscar by stanfy.
the class ImagesManagerAndroidTest method testSetup.
public void testSetup() {
ResponseCache cache = imagesManager.getImagesResponseCache();
assertThat(cache).isInstanceOf(ImageFileCache.class);
ImageFileCache imageFileCache = (ImageFileCache) cache;
assertThat(imageFileCache.getWorkingDirectory()).isNotNull();
assertThat(imageFileCache.getWorkingDirectory()).exists();
assertThat(imageFileCache.getWorkingDirectory()).isDirectory();
assertThat(imageFileCache.getMaxSize()).isGreaterThan(0);
}
Aggregations