While your program will work in simulator, you actually have to manage yuor cookies in yuor app, since it won't work otherwise on the actual device. The reason, is that MDS manages cookies for you, however on the device, there is no MDS.
Thus, managing your request yuo have to write something like:
if(this.cookie != null) _connection.setRequestHeader("Cookie", this.cookie);
and managing the response:
this.cookie = _connection.getHeaderField("Set-Cookie");