| 52 | } |
| 53 | |
| 54 | void TSockTest::TestTimeout() { |
| 55 | static const int timeout = 1000; |
| 56 | i64 startTime = millisec(); |
| 57 | try { |
| 58 | TNetworkAddress addr("localhost", 1313); |
| 59 | TSocket s(addr, TDuration::MilliSeconds(timeout)); |
| 60 | } catch (const yexception&) { |
| 61 | } |
| 62 | int realTimeout = (int)(millisec() - startTime); |
| 63 | if (realTimeout > timeout + 2000) { |
| 64 | TString err = TStringBuilder() << "Timeout exceeded: " << realTimeout << " ms (expected " << timeout << " ms)"; |
| 65 | UNIT_FAIL(err); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void TSockTest::TestConnectionRefused() { |
| 70 | TNetworkAddress addr("localhost", 1313); |
nothing calls this directly
no test coverage detected