Fix race condition in tcp output server mode

A race condition in tcp output could cause the shipper to die with an
exception because the thread's [:client] property would not yet be
initialised when the main program would start to put data into it:

NoMethodError: undefined method `write' for nil:NilClass
       register at lib/logstash/outputs/tcp.rb:143
           each at org/jruby/RubyArray.java:1613
       register at lib/logstash/outputs/tcp.rb:142
           call at org/jruby/RubyProc.java:271
         encode at lib/logstash/codecs/json_lines.rb:50
        receive at lib/logstash/outputs/tcp.rb:208
         handle at lib/logstash/outputs/base.rb:86
     initialize at (eval):47
           call at org/jruby/RubyProc.java:271
         output at lib/logstash/pipeline.rb:266
   outputworker at lib/logstash/pipeline.rb:225
  start_outputs at lib/logstash/pipeline.rb:152
Sync diagnostic messages of tcp input and output
Add SSL support to tcp output

Port the SSL bits from tcp input over to tcp output