response.setParam("Server", "Cindy Http Server");
response.setParam("Connection", keepAlive ? "keep-alive" : "close");
Future future = session.send(response); // send http header
if (content != null)
future = session.flush(new DefaultPacket(content)); // send content
if (!keepAlive)
future.addListener(new FutureListener() {
public void futureCompleted(Future future) throws Exception {
future.getSession().close();