| 155 | }; |
| 156 | |
| 157 | class test_default_connect : public test_handler { |
| 158 | public: |
| 159 | |
| 160 | void on_listener_start(container& c) override { |
| 161 | c.connect(); |
| 162 | } |
| 163 | |
| 164 | // on_transport_open will be called whatever happens to the connection whether it's |
| 165 | // connected or rejected due to error. |
| 166 | // |
| 167 | // We use a hacky way to get to the underlying C objects to check what's in them |
| 168 | void on_transport_open(proton::transport& transport) override { |
| 169 | proton::connection connection = transport.connection(); |
| 170 | internal_access_of<proton::connection, pn_connection_t> ic(connection); |
| 171 | pn_connection_t* c = ic.pn_object(); |
| 172 | ASSERT_EQUAL(std::string("localhost"), pn_connection_get_hostname(c)); |
| 173 | } |
| 174 | |
| 175 | void on_transport_error(proton::transport& t) override { |
| 176 | ASSERT_SUBSTRING("localhost:5671", t.error().description()); |
| 177 | t.connection().container().stop(); |
| 178 | } |
| 179 | |
| 180 | void run() { |
| 181 | container(*this).run(); |
| 182 | } |
| 183 | }; |
| 184 | |
| 185 | class test_host_user_pass : public test_handler { |
| 186 | public: |