Add tests to cover codec autoswitch for stdin + tcp inputs

json->json_lines & plain->line

Tests for #1392
Closes #1394
inputs/base: Copy the codec's charset when switching.

Includes tests
Merge git://github.com/logstash/logstash