int testConnectTransport() { Protocol a; Protocol b; std::string fora_raw; std::string forb_raw; uint64_t t = 0; a.listen(); std::vector<uint8_t> fora = b.connect(t); std::vector<uint8_t> forb; std::vector<uint8_t> out; for( int i = 0; i < 1000 ; i++) { out = a.dataEvent(fora,t).first; fora.clear(); forb.insert(forb.end(),out.begin(),out.end()); fora = b.dataEvent(forb,t).first; forb.clear(); out = a.timerEvent(t); forb.insert(forb.end(),out.begin(),out.end()); out = b.timerEvent(t); fora.insert(fora.end(),out.begin(),out.end()); t += 10; } ASSERT(a.state == STATE_CONNECTED); ASSERT(b.state == STATE_CONNECTED); for ( int i = 0; i < 10000 ; i++) { a.timerEvent(t); b.timerEvent(t); t += 10; } ASSERT(a.state == STATE_UNINIT); ASSERT(b.state == STATE_UNINIT); b.connect(t); ASSERT(b.state == STATE_CONNECTING); b.timerEvent(t); ASSERT(b.state == STATE_CONNECTING); for(int i = 0; i < 10000 ; i++) { b.timerEvent(t); t += 10; } ASSERT(b.state == STATE_UNINIT); return 0; }