#include "test_fixtures.hxx"
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
using namespace std;
using namespace libt2n;
-// this is an evil hack to get access to real_write, don't ever do this in an app!!!
-class real_write_connection: public socket_server_connection
-{
- public:
- void real_write(const std::string& data)
- { socket_write(data); }
-};
-
-class test_reconnectFixture : public KillChildOnShutdownFixture
-{
-protected:
- void send_raw_socket(string hello_string, socket_server* ss, int conn_id)
- {
- socket_server_connection *ssc=dynamic_cast<socket_server_connection*>(ss->get_connection(conn_id));
-
- // this is an evil hack to get access to real_write, don't ever do this in an app!!!
- real_write_connection *rwc=(real_write_connection*)ssc;
- rwc->real_write(hello_string);
- }
-
-public:
- test_reconnectFixture()
- {
- }
-
- ~test_reconnectFixture()
- {
- }
-};
-
-BOOST_FIXTURE_TEST_SUITE(test_reconnect, test_reconnectFixture)
+BOOST_FIXTURE_TEST_SUITE(test_reconnect, KillChildOnShutdownFixture)
BOOST_AUTO_TEST_CASE(simple_reconnect)
{
int size=blob.size()+1;
char sizetransfer[sizeof(int)+1];
memcpy(sizetransfer,(void*)&size,sizeof(int));
- sizetransfer[sizeof(int)+1]=0;
+ sizetransfer[sizeof(int)]=0;
string packet=string(sizetransfer)+blob;