String opaqueKey = request.getParameter("sessionId");
RemoteIOSNativeDriver
nativeDriver =
getDriver().getSession(opaqueKey).getDualDriver().getNativeDriver();
UIAutomationCommandExecutor channel = nativeDriver.communication();
if (channel instanceof CURLIAutomationCommandExecutor) {
return (CURLIAutomationCommandExecutor) channel;
} else {
throw new RuntimeException("Bug.Using a servlet to communicate with instruments only "
+ "makes sense in the case of a CURL based commandExecutor.For "