I had the exact same problem when I started writing code for the new
protocol. This is an oddity with the way the protocol spec uses EBNF to
specify arrays.

Checkout the section on protocol primitives, especially arrays.
https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-ProtocolPrimitiveTypes

Essentially, each array is preceded by its length as an int32.

With regards to your specific buffer:
<Buffer 00 00 00 16 00 03 00 00 00 00 00 00 00 03 66 6f 6f 00 07 6d 79
54 6f 70 69 63>

You seem to be missing the clientId as well as the array length. For
comparison the buffer, with the client I wrote, for clientId
"perl-kafka" and topics "foo" and "myTopic":

00 00 00 26 00 03 00 00 00 00 00 2a 00 0a 70 65 72 6c 2d 6b 61 66 6b 61
00 00 00 02 00 03 66 6f 6f 00 07 6d 79 54 6f 70 69 63
On 07/08/2013 04:12 AM, Vinicius Carvalho wrote:
*Colin Blower*
/Software Engineer/
Barracuda Networks Inc.
+1 408-342-5576 (o)
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB