factor out send command typeId into TcpSender and add some missing javadoc.