int main(int argc, char *argv[])
{
    TestConnections * Test = new TestConnections(argc, argv);
    char sql[10240];

    Test->connect_maxscale();
    create_t1(Test->conn_rwsplit);

    Test->tprintf("INSERTing data\n");
    for (int i = 0; i < 2000; i++)
    {
        Test->set_timeout(20);
        create_insert_string(sql, 100, i);
        Test->try_query(Test->conn_rwsplit, sql);
    }
    Test->tprintf("done, sleeping\n");
    Test->stop_timeout();
    sleep(20);
    Test->tprintf("Trying SELECT\n");
    Test->set_timeout(30);
    Test->try_query(Test->conn_rwsplit, (char *) "SELECT * FROM t1");

    Test->check_maxscale_alive();
    int rval = Test->global_result;
    delete Test;
    return rval;
}
int main(int argc, char *argv[])
{
    pthread_t parall_traffic1[100];
    int check_iret[100];

    Test = new TestConnections(argc, argv);
    int global_result = 0;

    Test->read_env();
    Test->print_env();

    printf("Connecting to RWSplit %s\n", Test->maxscale_IP);
    Test->connect_rwsplit();

    global_result += create_t1(Test->conn_rwsplit);
    create_insert_string(sql, 65000, 1);


    for (int j = 0; j < 25; j++) {
        check_iret[j] = pthread_create( &parall_traffic1[j], NULL, parall_traffic, NULL);
    }

    sleep(1);

    printf("Setup firewall to block mysql on master\n"); fflush(stdout);
    Test->repl->block_node(0); fflush(stdout);

    sleep(1);

    printf("Trying query to RWSplit, expecting failure, but not a crash\n"); fflush(stdout);
    execute_query(Test->conn_rwsplit, (char *) "show processlist;");fflush(stdout);

    sleep(1);

    printf("Setup firewall back to allow mysql\n"); fflush(stdout);
    Test->repl->unblock_node(0); fflush(stdout);
    sleep(10);
    exit_flag = 1;
    sleep(10);

    printf("Checking Maxscale is alive\n"); fflush(stdout);
    global_result += check_maxscale_alive(); fflush(stdout);

    Test->close_rwsplit(); fflush(stdout);


    printf("Reconnecting and trying query to RWSplit\n"); fflush(stdout);
    Test->connect_rwsplit();
    global_result += execute_query(Test->conn_rwsplit, (char *) "show processlist;");
    Test->close_rwsplit();

    exit_flag = 1;
    sleep(10);

    Test->copy_all_logs(); return(global_result);
}