Code example for BasicStatusLine

0
    } 
 
    private void sendResponse(Address us, int code, String statusString, String uid, byte[] body) {
        MemorySessionOutputBuffer outBuf = new MemorySessionOutputBuffer();
        HttpMessageWriter writer = new HttpResponseWriter(outBuf, lineFormatter, params);
        HttpMessage response = new BasicHttpResponse(new BasicStatusLine(PROTOCOL_VERSION, code, statusString));
        response.addHeader("Request-Id", uid);
        try { 
            writer.write(response);
            outBuf.write(body);
            outBuf.flush();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (HttpException e) {
            throw new RuntimeException(e);
        } 
        byte[] data = outBuf.getOutput();
        Message message = new Message("");
        message.setFrom(us);
        debug("send response"); 
        mChatSession.sendDataAsync(message, true, data);