Not able to turn on and off data using connection

Hello,

I am automating Android App using Appium 1.6.4, I am not able to switch off/on connection.

Can anyone please help me here?

Here is the error log which I am getting.

[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/c937c36a-6156-4ff3-adc2-feaf7732cdc8/network_c
onnection] to [POST http://127.0.0.1:8000/wd/hub/session/1e244f813ffbbd52b6cb0fabbaeebf8b/network_co
nnection] with body: {"name":"network_connection","parameters":{"type":1}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"1e244f813ffbbd52b6cb0fabbaeebf8b"
,"status":13,"value":{"message":"unknown error: operation is unsupported on Android\n  (Session info
: chrome=58.0.3029.83)\n  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc5679
15b233),platform=Windows NT 6.1.7601 SP1 x86_64)"}}
[JSONWP Proxy] Replacing sessionId 1e244f813ffbbd52b6cb0fabbaeebf8b with c937c36a-6156-4ff3-adc2-fea
f7732cdc8

The code I typed to do this -

((AndroidDriver)driver).setConnection(Connection.AIRPLANE);