/*static*/ uint32_t TestTestTCPConnectionPool::TestConnectionStuckDuringSend_ThreadFunc( void * userData )
{
    const ConnectionInfo * ci = (const ConnectionInfo *)userData;
    TCPConnectionPool & client = ci->GetTCPConnectionPool();
    // send lots of data to slow server
    AutoPtr< char > mem( FNEW( char[ 10 * MEGABYTE ] ) );
    for ( size_t i=0; i<1000; ++i )
    {
        if ( !client.Send( ci, mem.Get(), 10 * MEGABYTE ) )
        {
            break;
        }
    }
    return 0;
}
    const ConnectionInfo * ci = client.Connect( AStackString<>( "127.0.0.1" ), testPort );
    TEST_ASSERT( ci );

    size_t sendSize = 31;
    while ( sendSize <= maxSendSize )
    {
        server.m_ReceivedBytes = 0;
        server.m_DataSize = sendSize;

        Timer timer;

        size_t totalSent = 0;
        while ( timer.GetElapsed() < 0.1f )
        {
            // client sends some know data to the server
            TEST_ASSERT( client.Send( ci, data.Get(), sendSize ) );
            totalSent += sendSize;
        }

        while( server.m_ReceivedBytes < totalSent )
        {
            Thread::Sleep( 1 );
        }

        const float speedMBs = ( float( totalSent ) / timer.GetElapsed() ) / float( 1024 * 1024 );
        OUTPUT( "Speed: %2.1f MiB/s, SendSize: %u\n", speedMBs, (uint32_t)sendSize );

        sendSize = ( sendSize * 2 ) + 33; // +33 to avoid powers of 2
    }
}
    // client
    TCPConnectionPool client;
    const ConnectionInfo * ci = client.Connect( AStackString<>( "127.0.0.1" ), testPort );
    TEST_ASSERT( ci );

    size_t testSize = 1;
    while ( testSize <= maxDataSize )
    {
        for ( size_t repeat = 0; repeat < 8; ++repeat )
        {
            server.m_ReceivedOK = false;
            server.m_DataSize = testSize;

            // client sends some know data to the server
            client.Send( ci, data.Get(), testSize );

            while( !server.m_ReceivedOK )
            {
                Thread::Sleep( 1 );
            }
        }

        testSize = ( testSize * 2 ) + 33; // +33 to avoid powers of 2
    }
}

// TestConnectionStuckDuringSend
//------------------------------------------------------------------------------
void TestTestTCPConnectionPool::TestConnectionStuckDuringSend() const
{