def _countConnections(self, port):
        pid = os.getpid()
        p1 = Popen(
            ['lsof', '-a', '-p%s' % pid, '-i4'], stdout=PIPE)
        p2 = Popen(["grep", ":%s" % port], stdin=p1.stdout, stdout=PIPE)
        p3 = Popen(["wc", "-l"], stdin=p2.stdout, stdout=PIPE)
        output = p3.communicate()[0]
        return int(output.strip())
dataset/ETHPy150Open serverdensity/sd-agent/tests/checks/integration/test_mcache.py/TestMemCache._countConnections/original