move TcpConnection to separate file