MCPcopy Create free account
hub / github.com/apache/qpid-proton / test_reconnecting_close

Class test_reconnecting_close

cpp/src/reconnect_test.cpp:332–362  ·  view source on GitHub ↗

Verify we can stop reconnecting by calling close() in on_transport_error()

Source from the content-addressed store, hash-verified

330
331// Verify we can stop reconnecting by calling close() in on_transport_error()
332class test_reconnecting_close : public proton::messaging_handler, public waiter {
333 public:
334 test_reconnecting_close() : waiter(1), container_(*this, "test_reconnecting_close") {}
335
336 void on_container_start(proton::container &c) override {
337 s1.reset(new server_connection_handler(c, 0, *this));
338 }
339
340 void ready() override {
341 container_.connect(s1->url(), proton::connection_options().reconnect(proton::reconnect_options()));
342 }
343
344 void on_transport_error(proton::transport& t) override {
345 transport_error_called = true;
346 t.connection().close(); // Abort reconnection
347 }
348
349 void on_connection_close(proton::connection& c) override {
350 ASSERT(0); // Not expecting any clean close
351 }
352
353 void run() {
354 container_.run();
355 }
356
357 private:
358 proton::container container_;
359 std::string err_;
360 bool transport_error_called = false;
361 std::unique_ptr<server_connection_handler> s1;
362};
363
364int test_auth_fail_reconnect() {
365 authfail_reconnect_tester().run();

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by 1

mainFunction · 0.68