views:

26

answers:

0

Hello, Is there anyone who use testcase for the windows async socket?

right now, I make a testcase as following:

TEST(TestAsync) {
    Model* model = Model.getInstance();
    Account* account = model->getAccount();
    account->setId("[email protected]");
    account->setPassword("password!");

    MyAsyncSocket* socket = new MyAsyncSocket(InetAddress.getByName("domain.com"), 8888);

    int transactionId = 0;
    transactionId = socket->send("custom id");
    socket->waitForResponse(transactionId);
    socket->processResponse();
    assertEquals(socket.headers.length, 3);
    socket->clearBuffer();

    socket->close();
    delete socket;
}

but I think is is not good one and there should a good solution Can you recommand another one?