code: public static byte[] concatLengthPrefixed(List<Protocol> protocols) {
      Buffer result = new Buffer();
      for (int i = 0, size = protocols.size(); i < size; i++) {
        Protocol protocol = protocols.get(i);
        if (protocol == Protocol.HTTP_1_0) continue; // No HTTP/1.0 for ALPN.
        result.writeByte(protocol.toString().length());
        result.writeUtf8(protocol.toString());
      }
      return result.readByteArray();
    }
docs: Returns the concatenation of 8-bit, length prefixed protocol names.
  http://tools.ietf.org/html/draft-agl-tls-nextprotoneg-04#page-4