function Android() {
this.connection = new java.net.Socket(String(AP_HOST), AP_PORT),
this.input = new java.io.BufferedReader(
new java.io.InputStreamReader(this.connection.getInputStream(), "utf-8"),
1 << 13),
this.output = new java.io.PrintWriter(new java.io.OutputStreamWriter(
new java.io.BufferedOutputStream(this.connection.getOutputStream(),
1 << 13),
"utf-8"), true),
this.id = 0,
this.rpc = function(method, args) {
this.id += 1;
var request = JSON.stringify({'id': this.id, 'method': method,
'params': args});
this.output.write(request + '\n');
this.output.flush();
var response = this.input.readLine();
return eval("(" + response + ")");
},
this.__noSuchMethod__ = function(id, args) {
var response = this.rpc(id, args);
if (response.error != null) {
throw response.error;
}
return response.result;
}
this._authenticate(String(AP_HANDSHAKE));
}