response.setParam("Content-Type", "text/plain");
response.setParam("Content-Length", String.valueOf(header.length));
response.setParam("Connection", keepAlive ? "keep-alive" : "close");
response.setContent(header);
Future future = session.send(response);
if (!keepAlive)
future.addListener(new FutureListener() {
public void futureCompleted(Future future) throws Exception {
future.getSession().close();
}
});
}