Encoding headers can overrun the buffer.

Validate buffer size while encoding headers, and pass the NSError back
up the stack. If over 16K of headers are encoded, this will result
in the stream being closed.
Feedback from last change.

Change error code and buffer size tweak.
Merge pull request #52 from kgoodier/encode-headers-crash

Encode headers crash