Change screen orientation to landscape mode throws error

I am trying to change screen orientation to landscape mode through this code .

    ((AppiumDriver) driver).rotate(ScreenOrientation.LANDSCAPE);

But it throws this error

  info: JSONWP Proxy: Proxying [POST /wd/hub/session/27a135cb3d803bed1273ff08c4b2b5bc/orientation] to [POST] with body: {"orientation":"LANDSCAPE"}
 > error: Could not proxy command to remote server. Original error: 501 - unimplemented command: session/27a135cb3d803bed1273ff08c4b2b5bc/orientation

Appium Version :- 1.4.16
selenium version:- 2.53.0

Thanks Wafe_is_7,

But i could see the same error even after i implemented ur suggestion .


is there any other way around ?

I use -
if (deviceVersion.contains(IPAD)) { iosDriver.rotate(ScreenOrientation.LANDSCAPE); }
it works for me