setNetworkConnection() giving Cannot call method 'shell' of null Command

Hi,

I am trying to switch on wifi with following command:

appiumDriver.setNetworkConnection(new NetworkConnectionSetting(false, true, false));

I am getting following error:

org.openqa.selenium.WebDriverException: ERROR running Appium command: Cannot call method ‘shell’ of null
Command duration or timeout: 7 milliseconds
Build info: version: ‘2.42.2’, revision: ‘6a6995d31c7c56c340d6f45a76976d43506cd6cc’, time: ‘2014-06-03 10:52:47’
System info: os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10’, java.version: ‘1.8.0_25’
Driver info: io.appium.java_client.AppiumDriver

My appium server logs are:

TypeError: Cannot read property ‘restart’ of null
at Android.wrapActionAndHandleADBDisconnect (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android.js:186:15)
at null. (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-common.js:886:10)
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:610:21
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:249:17
at iterate (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:149:13)
at async.eachSeries (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:165:9)
at _asyncMap (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:248:13)
at Object.mapSeries (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:231:23)
at Object.async.series (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:608:19)
at androidCommon.setNetworkConnection (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-common.js:907:9)
info: --> GET /wd/hub/session/77f8e7fa-cd92-446d-9aa8-277e3561e544/screenshot {}
info: <-- GET /wd/hub/session/77f8e7fa-cd92-446d-9aa8-277e3561e544/screenshot 500 3.117 ms - 88
TypeError: Cannot call method ‘shell’ of null
at async.series.cb.status (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-controller.js:548:16)
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:610:21
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:249:17
at iterate (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:149:13)
at async.eachSeries (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:165:9)
at _asyncMap (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:248:13)
at Object.mapSeries (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:231:23)
at Object.async.series (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:608:19)
at androidController.getScreenshot (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-controller.js:543:9)
at Object.exports.getScreenshot [as handle] (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/server/controller.js:812:14)

Hi,
I am getting the same issue while trying to enable airplane mode and disable data and wifi. I tried in both emulator as well as real device but the issue keep occurring. Were you able to find a solution to this problem?

Thanks!