use of android.net.NetworkInfo in project picasso by square.
the class DispatcherTest method performNetworkStateChangeWithConnectedInfoDifferentInstanceIgnores.
@Test
public void performNetworkStateChangeWithConnectedInfoDifferentInstanceIgnores() {
Dispatcher dispatcher = createDispatcher(serviceMock);
NetworkInfo info = mockNetworkInfo(true);
dispatcher.performNetworkStateChange(info);
verifyZeroInteractions(service);
}
use of android.net.NetworkInfo in project picasso by square.
the class DispatcherTest method performNetworkStateChangeWithDisconnectedInfoIgnores.
@Test
public void performNetworkStateChangeWithDisconnectedInfoIgnores() {
Dispatcher dispatcher = createDispatcher(serviceMock);
NetworkInfo info = mockNetworkInfo();
when(info.isConnectedOrConnecting()).thenReturn(false);
dispatcher.performNetworkStateChange(info);
verifyZeroInteractions(service);
}
use of android.net.NetworkInfo in project picasso by square.
the class DispatcherTest method performNetworkStateChangeWithConnectedInfoAndPicassoExecutorServiceAdjustsThreads.
@Test
public void performNetworkStateChangeWithConnectedInfoAndPicassoExecutorServiceAdjustsThreads() {
PicassoExecutorService service = mock(PicassoExecutorService.class);
NetworkInfo info = mockNetworkInfo(true);
Dispatcher dispatcher = createDispatcher(service);
dispatcher.performNetworkStateChange(info);
verify(service).adjustThreadCount(info);
verifyZeroInteractions(service);
}
use of android.net.NetworkInfo in project FBReaderJ by geometer.
the class AndroidNetworkContext method perform.
@Override
protected void perform(ZLNetworkRequest request, int socketTimeout, int connectionTimeout) throws ZLNetworkException {
final NetworkInfo info = getActiveNetworkInfo();
if (info == null || !info.isConnected()) {
throw ZLNetworkException.forCode("networkNotAvailable");
}
super.perform(request, socketTimeout, connectionTimeout);
}
use of android.net.NetworkInfo in project fqrouter by fqrouter.
the class LaunchService method getApnName.
private String getApnName() {
try {
ConnectivityManager conManager = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = conManager.getActiveNetworkInfo();
if (null == ni) {
return "";
}
return ni.getExtraInfo();
} catch (Exception e) {
LogUtils.e("failed to get apn name", e);
return "";
}
}
Aggregations