JSONException {
BufferedWriter bw = new BufferedWriter(output);
try {
FunctionRequest fr = JSONCodec.decodeRequest(input);
System.out.println(JSONCodec.encodeRequest(fr).toString(4));
XLoper res = handler.execute(null, fr.getName(), fr.getArgs());
System.out.println(JSONCodec.encode(res).toString(4));
JSONCodec.encodeXLoper(res, bw);
} catch (RequestException e) {
e.printStackTrace();
XLoper res = new XLString(e.getMessage());
JSONCodec.encodeXLoper(res, bw);
bw.flush();
} finally {
if (bw != null)
bw.flush();