public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
LOG.debug("encode {}", message.getClass().getCanonicalName());
if (message instanceof HttpResponse) {
LOG.debug("HttpResponse");
HttpResponse msg = (HttpResponse) message;
StringBuilder sb = new StringBuilder(msg.getStatus().line());
for (Map.Entry<String, String> header : msg.getHeaders().entrySet()) {
sb.append(header.getKey());
sb.append(": ");
sb.append(header.getValue());
sb.append("\r\n");
}