virtual DBClientConnection *newClientConnection() const { MockDBClientConnection * c = new MockDBClientConnection(); c->connect( connect_ ); c->one( one_ ); return c; }
mongol::DBClientBase* MockConnRegistry::MockConnHook::connect(const ConnectionString& connString, std::string& errmsg, double socketTimeout) { const string hostName(connString.toString()); MockDBClientConnection* conn = _registry->connect(hostName); if (!conn->connect(hostName.c_str(), errmsg)) { // Assumption: connect never throws, so no leak. delete conn; // mimic ConnectionString::connect for MASTER type connection to return NULL // if the destination is unreachable. return NULL; } return conn; }