def METHOD_NAME(self):
    assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)
    assert_equal(self.nodes[0].getnetworkinfo()['connections'], 2)
    self.nodes[0].setnetworkactive(False)
    assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], False)
    # Wait a bit for all sockets to close
    wait_until(lambda: self.nodes[0].getnetworkinfo()['connections'] == 0, timeout=3)
    wait_until(lambda: self.nodes[1].getnetworkinfo()['connections'] == 0, timeout=3)
    self.nodes[0].setnetworkactive(True)
    connect_nodes_bi(self.nodes, 0, 1)
    assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)
    assert_equal(self.nodes[0].getnetworkinfo()['connections'], 2)