private static String print(Message msg, Map<String, Header> hdrs) {
StringBuilder sb=new StringBuilder();
int hdrs_size=0;
for(Map.Entry<String,Header> entry: hdrs.entrySet()) {
String name=entry.getKey();
Header hdr=entry.getValue();
int size=hdr.size();
hdrs_size+=size;
sb.append(name).append(": ").append(" ").append(size).append(" bytes\n");
}
sb.append("headers=").append(hdrs_size).append(", total msg size=").append(msg.size());
sb.append(", msg payload=").append(msg.getLength()).append("\n");