'Check if client can connect to server using tcp transport'

def can_connect(self, server, client):

    result = False
    iface = 'tcp://127.0.0.1'
    port = server.bind_to_random_port(iface)
    client.connect(('%s:%i' % (iface, port)))
    msg = ['Hello    World']
    if server.poll(1000, zmq.POLLOUT):
        server.send_multipart(msg)
    if client.poll(1000):
        rcvd_msg = client.recv_multipart()
        self.assertEqual(rcvd_msg, msg)
        result = True
    return result
