writeLengthField(headerBlock, numHeaders);
for (String name: names) {
byte[] nameBytes = name.getBytes("UTF-8");
writeLengthField(headerBlock, nameBytes.length);
headerBlock.writeBytes(nameBytes);
int savedIndex = headerBlock.writerIndex();
int valueLength = 0;
writeLengthField(headerBlock, valueLength);
for (String value: headerFrame.getHeaders(name)) {
byte[] valueBytes = value.getBytes("UTF-8");
if (valueBytes.length > 0) {