add generic TCP handler with SSL support, move StateObject into netlib
complete state handling