Пример #1
0
void ClassicLadderEndOfAppli( void )
{
	CyclicThreadRunning = 0;
	if(modmaster)  {   CloseSocketModbusMaster( );   }
	if(modslave)   {   CloseSocketServer( );   }

}
enum TVerdict TE_RConnectionTest500::doTestStepL(void)
{
    TInt err;

    RSocketServ socketServer;
    RHostResolver hostResolver;

    err = OpenSocketServer(socketServer);
    TESTEL(KErrNone == err, err);
    CleanupClosePushL(socketServer);

    err = OpenHostResolver(hostResolver, socketServer);
    TESTEL(KErrNone == err, err);
    CleanupClosePushL(hostResolver);

    err = MakeSynchronousNameRequest(hostResolver, iTestName); // this will use GetByName()
    TESTEL(KErrIfAuthenticationFailure == err, err);

    DestroyHostResolver(hostResolver);
    CleanupStack::Pop();

    CloseSocketServer(socketServer);
    CleanupStack::Pop(&socketServer);	// just sanity check our pops

    return TestStepResult();
}
// creates a connection and destroys it again
// Implicitly detect a single connection using SendTo()
enum TVerdict TE_RConnectionTest306::doTestStepL(void)
{
	TInt err;

	RSocketServ ss;
	RSocket sock;

	RConnection monitor;
	TRequestStatus status;
	TInterfaceNotificationBuf info;

	err = OpenSocketServer(ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(ss);

	err = OpenConnection(monitor, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(monitor);

	err = OpenTcpSocket(sock, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(sock);

	// issue request
	AllInterfaceNotification(monitor, status, info);

	err = ConnectTcpSocket(sock, iEchoServerAddr); // this will use Connect()
	TESTEL(KErrNone == err, err);

	err = TestTcpDataPathL(sock);
	TESTEL(KErrNone == err, err);

	// check for interface up...
	CheckInterfaceNotificationL(status, info, EInterfaceUp);

	// issue request
	AllInterfaceNotification(monitor, status, info);

	err = DestroyTcpSocket(sock);
	TESTEL(KErrNone == err, err);
	CleanupStack::Pop();

	// check for interface down...
	CheckInterfaceNotificationL(status, info, EInterfaceDown);

	CloseConnection(monitor);
	CleanupStack::Pop();

	CloseSocketServer(ss);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest306
// creates a connection and destroys it again
enum TVerdict TE_RConnectionTest301::doTestStepL(void)
{
	TInt err;

	RConnection activeConn;
	RConnection conn;
	RSocketServ ss;

	TRequestStatus status;
	TInterfaceNotificationBuf info;

	err = OpenSocketServer(ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(ss);

	err = OpenConnection(conn, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(conn);

	err = OpenConnection(activeConn, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(activeConn);

	err = StartConnectionWithOverrides(conn, 1);
	TESTEL(KErrNone == err, err);

	// issue request
	AllInterfaceNotification(conn, status, info);

	// start another different connection to complete request if it hasn't already done so
	err = StartConnectionWithOverrides(activeConn, 6);
	TESTEL(KErrNone == err, err);

	// wait for completion
	User::WaitForRequest(status);

	// check for correct value
	TESTEL(status.Int() == KErrInUse, status.Int());

	CloseConnection(activeConn);
	CleanupStack::Pop();

	CloseConnection(conn);
	CleanupStack::Pop();

	CloseSocketServer(ss);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest301
// Implicitly create a single connection using GetByName()
enum TVerdict TE_RConnectionTest307::doTestStepL(void)
{
	TInt err;

	RSocketServ ss;
	RHostResolver hr;

	RConnection monitor;
	TRequestStatus status;
	TInterfaceNotificationBuf info;

	err = OpenSocketServer(ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(ss);

	err = OpenConnection(monitor, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(monitor);

	err = OpenHostResolver(hr, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(hr);

	// issue request
	AllInterfaceNotification(monitor, status, info);

	err = MakeNameRequest(hr, iTestName); // this will use GetByName()
	TESTEL(KErrNone == err, err);

	// check for interface up...
	CheckInterfaceNotificationL(status, info, EInterfaceUp);

	// issue request
	AllInterfaceNotification(monitor, status, info);

	DestroyHostResolver(hr);
	CleanupStack::Pop();

	// check for interface down...
	CheckInterfaceNotificationL(status, info, EInterfaceDown);

	CloseConnection(monitor);
	CleanupStack::Pop();

	CloseSocketServer(ss);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest307
// creates a connection and destroys it again
enum TVerdict TE_RConnectionTest304::doTestStepL(void)
{
	TInt err;

	RSocketServ socketServer;
	RConnection connection;
	RConnection monitor;

	TRequestStatus status;
	TInterfaceNotificationBuf info;

	err = OpenSocketServer(socketServer);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(socketServer);

	err = OpenConnection(connection, socketServer);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(connection);

	err = OpenConnection(monitor, socketServer);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(monitor);

	// issue request
	AllInterfaceNotification(monitor, status, info);

	// start connection to complete request
	err = StartConnection(connection);
	TESTEL(KErrNone == err, err);

	CheckInterfaceNotificationL(status, info, EInterfaceUp, &connection);

	// issue request
	AllInterfaceNotification(monitor, status, info);

	CloseConnection(connection);
	CleanupStack::Pop();

	CheckInterfaceNotificationL(status, info, EInterfaceDown);

	CloseConnection(monitor);
	CleanupStack::Pop();

	CloseSocketServer(socketServer);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest304
// Test multiple monitors receive notifications from multiple interfaces
enum TVerdict TE_RConnectionTest313::doTestStepL(void)
{
	TInt err;
	TInt i;
	TInt j;		// used for nested loops

	RSocketServ ss;
	RConnection connection[ KTS313_NoofConnections ];
	TInt iapId[] = {ListOfSuitableIAPs};

	RConnection monitor[ KTS313_NoofMonitors ];
	TRequestStatus status[ KTS313_NoofMonitors ];
	TInterfaceNotificationBuf info[ KTS313_NoofMonitors ];

	err = OpenSocketServer(ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(ss);

	for( i = 0; i < KTS313_NoofMonitors; i++ )
		{
		err = OpenConnection(monitor[i], ss);
		TESTEL(KErrNone == err, err);
		CleanupClosePushL(monitor[i]);
		}

	for( i = 0; i < KTS313_NoofConnections; i++ )
		{
		err = OpenConnection(connection[i], ss);
		TESTEL(KErrNone == err, err);
		CleanupClosePushL(connection[i]);
		}

	// issue requests
	for( i = 0; i < KTS313_NoofMonitors; i++ )
		{
		AllInterfaceNotification(monitor[i], status[i], info[i]);
		}

	// start several different connections
	for( i = 0; i < KTS313_NoofConnections; i++ )
		{
		// the first of these should complete the initial request,
		// the remainder should fill the cache
		err = StartConnectionWithOverrides(connection[i], iapId[i]);
		TESTEL(KErrNone == err, err);
		}

	for( j = 0; j < KTS313_NoofConnections; j++ )
		{
		for( i = 0; i < KTS313_NoofMonitors; i++ )
			{
			CheckInterfaceNotificationL(status[i], info[i], EInterfaceUp, &connection[j]);

			// re-issue requests, which should complete immediately with cached status
			AllInterfaceNotification(monitor[i], status[i], info[i]);
			}

		} // for j

	// NOTE: request outstanding at this point...

	// close connections
	for( i = 0; i < KTS313_NoofConnections; i++ )
		{
		CloseConnection(connection[i]);
		CleanupStack::Pop();
		}

	for( j = 0; j < KTS313_NoofConnections; j++ )
		{
		// check for interface down...
		for( i = 0; i < KTS313_NoofMonitors; i++ )
			{
			CheckInterfaceNotificationL(status[i], info[i], EInterfaceDown, NULL);

			// except after last check...
			if( j != (KTS313_NoofConnections - 1) )
				{
				// ...re-issue request, which should complete immediately with cached status
				AllInterfaceNotification(monitor[i], status[i], info[i]);
				}
			}


		} // for j

	// close monitors
	for( i = 0; i < KTS313_NoofMonitors; i++ )
		{
		CloseConnection(monitor[i]);
		CleanupStack::Pop();
		}

	CloseSocketServer(ss);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest313
// Implicitly create a single connection using GetByName()
enum TVerdict TE_RConnectionTest311::doTestStepL(void)
{
	TInt err;
	TInt i;

	RSocketServ ss;
	RHostResolver hr;

	RConnection monitor[ KTS311_NoofMonitors ];
	TRequestStatus status[ KTS311_NoofMonitors ];
	TInterfaceNotificationBuf info[ KTS311_NoofMonitors ];

	err = OpenSocketServer(ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(ss);

	for( i = 0; i < KTS311_NoofMonitors; i++ )
		{
		err = OpenConnection(monitor[i], ss);
		TESTEL(KErrNone == err, err);
		CleanupClosePushL(monitor[i]);
		}

	err = OpenHostResolver(hr, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(hr);

	// issue requests
	for( i = 0; i < KTS311_NoofMonitors; i++ )
		{
		AllInterfaceNotification(monitor[i], status[i], info[i]);
		}

	err = MakeNameRequest(hr, iTestName); // this will use GetByName()
	TESTEL(KErrNone == err, err);

	// check for interface up...
	for( i = 0; i < KTS311_NoofMonitors; i++ )
		{
		CheckInterfaceNotificationL(status[i], info[i], EInterfaceUp);
		}

	// issue requests
	for( i = 0; i < KTS311_NoofMonitors; i++ )
		{
		AllInterfaceNotification(monitor[i], status[i], info[i]);
		}

	DestroyHostResolver(hr);
	CleanupStack::Pop();

	// check for interface down...
	for( i = 0; i < KTS311_NoofMonitors; i++ )
		{
		CheckInterfaceNotificationL(status[i], info[i], EInterfaceDown);
		}

	// close monitors
	for( i = 0; i < KTS311_NoofMonitors; i++ )
		{
		CloseConnection(monitor[i]);
		CleanupStack::Pop();
		}

	CloseSocketServer(ss);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest311
// creates a connection and destroys it again
// Implicitly detect a single connection using SendTo()
enum TVerdict TE_RConnectionTest310::doTestStepL(void)
{
	TInt err;
	TInt i;

	RSocketServ ss;
	RSocket sock;

	RConnection monitor[ KTS310_NoofMonitors ];
	TRequestStatus status[ KTS310_NoofMonitors ];
	TInterfaceNotificationBuf info[ KTS310_NoofMonitors ];

	err = OpenSocketServer(ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(ss);

	for( i = 0; i < KTS310_NoofMonitors; i++ )
		{
		err = OpenConnection(monitor[i], ss);
		TESTEL(KErrNone == err, err);
		CleanupClosePushL(monitor[i]);
		}

	err = OpenUdpSocketL(sock, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(sock);

	// issue requests
	for( i = 0; i < KTS310_NoofMonitors; i++ )
		{
		AllInterfaceNotification(monitor[i], status[i], info[i]);
		}

	err = TestUdpDataPathL(sock, iDummyNifSendAddr); // this will use SendTo()
	TESTEL(KErrNone == err, err);

	// check for interface up...
	for( i = 0; i < KTS310_NoofMonitors; i++ )
		{
		CheckInterfaceNotificationL(status[i], info[i], EInterfaceUp);
		}

	// issue requests
	for( i = 0; i < KTS310_NoofMonitors; i++ )
		{
		AllInterfaceNotification(monitor[i], status[i], info[i]);
		}

	DestroyUdpSocket(sock);
	CleanupStack::Pop();

	// check for interface down...
	for( i = 0; i < KTS310_NoofMonitors; i++ )
		{
		CheckInterfaceNotificationL(status[i], info[i], EInterfaceDown);
		}

	// close monitors
	for( i = 0; i < KTS310_NoofMonitors; i++ )
		{
		CloseConnection(monitor[i]);
		CleanupStack::Pop();
		}

	CloseSocketServer(ss);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest310
// creates a connection and destroys it again
enum TVerdict TE_RConnectionTest308::doTestStepL(void)
{
	TInt err;
	TInt i;

	RSocketServ socketServer;
	RConnection connection;

	RConnection monitor[ KTS308_NoofMonitors ];
	TRequestStatus status[ KTS308_NoofMonitors ];
	TInterfaceNotificationBuf info[ KTS308_NoofMonitors ];

	err = OpenSocketServer(socketServer);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(socketServer);

	err = OpenConnection(connection, socketServer);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(connection);

	for( i = 0; i < KTS308_NoofMonitors; i++ )
		{
		err = OpenConnection(monitor[i], socketServer);
		TESTEL(KErrNone == err, err);
		CleanupClosePushL(monitor[i]);
		}

	// issue requests
	for( i = 0; i < KTS308_NoofMonitors; i++ )
		{
		AllInterfaceNotification(monitor[i], status[i], info[i]);
		}

	// start connection to complete request
	err = StartConnection(connection);
	TESTEL(KErrNone == err, err);

	// check for interface up...
	for( i = 0; i < KTS308_NoofMonitors; i++ )
		{
		CheckInterfaceNotificationL(status[i], info[i], EInterfaceUp, &connection);
		}

	// issue requests
	for( i = 0; i < KTS308_NoofMonitors; i++ )
		{
		AllInterfaceNotification(monitor[i], status[i], info[i]);
		}

	CloseConnection(connection);
	CleanupStack::Pop();

	// check for interface down...
	for( i = 0; i < KTS308_NoofMonitors; i++ )
		{
		CheckInterfaceNotificationL(status[i], info[i], EInterfaceDown, NULL);
		}

	// close monitors
	for( i = 0; i < KTS308_NoofMonitors; i++ )
		{
		CloseConnection(monitor[i]);
		CleanupStack::Pop();
		}

	CloseSocketServer(socketServer);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest308
// creates a connection and destroys it again
enum TVerdict TE_RConnectionTest303::doTestStepL(void)
{
	TInt err;

	RConnection conn;
	RConnection monConn;
	RSocketServ ss;
	TRequestStatus status;
	TInterfaceNotificationBuf info;

	err = OpenSocketServer(ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(ss);

	err = OpenConnection(conn, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(conn);

	err = OpenConnection(monConn, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(monConn);

	// issue request
	AllInterfaceNotification(monConn, status, info);

	// start another different connection to complete request if it hasn't already done so
	err = StartConnectionWithOverrides(conn, 1);
	TESTEL(KErrNone == err, err);

	// wait for completion - to ensure that monitoring actually occurs
	User::WaitForRequest(status);

	// check for correct value
	TESTEL(status.Int() == KErrNone, status.Int());

	// issue another request (to be cancelled)
	AllInterfaceNotification(monConn, status, info);

	User::After(iShortTimeout);  // wait for a period of time

	// cancel request
	CancelAllInterfaceNotificationL(monConn);

	// wait for request completion
	User::WaitForRequest(status);

	// check for correct value
	TESTEL(status.Int() == KErrCancel, status.Int());

	CloseConnection(monConn);
	CleanupStack::Pop();

	CloseConnection(conn);
	CleanupStack::Pop();

	CloseSocketServer(ss);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest303
// creates a connection and destroys it again
enum TVerdict TE_RConnectionTest302::doTestStepL(void)
{
	TInt err;

	RConnection activeConn;
	RConnection conn;
	RConnection conn2;
	RSocketServ ss;
	TUint numOfConnections;
	TPckgBuf<TConnectionInfo> connInfo;

	TRequestStatus status;
	TInterfaceNotificationBuf info;

	err = OpenSocketServer(ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(ss);

	err = OpenConnection(conn, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(conn);

	err = OpenConnection(conn2, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(conn2);

	err = OpenConnection(activeConn, ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(activeConn);

	err = StartConnectionWithOverrides(conn, 1);
	TESTEL(KErrNone == err, err);

	// need to call Enumerate() before GetConnectionInfo() to set up array used there
	err = EnumerateConnections(conn, numOfConnections);
	TESTEL(KErrNone == err, err);
	TESTEL(1 == numOfConnections, numOfConnections);

	err = conn.GetConnectionInfo(1, connInfo);
	TESTEL(KErrNone == err, err);

	err = AttachNormal(conn2, connInfo);
	TESTEL(KErrNone == err, err);

	// issue request
	AllInterfaceNotification(conn2, status, info);

	// start another different connection to complete request if it hasn't already done so
	err = StartConnectionWithOverrides(activeConn, 6);
	TESTEL(KErrNone == err, err);

	// wait for completion
	User::WaitForRequest(status);

	// check for correct value
	TESTEL(status.Int() == KErrInUse, status.Int());

	CloseConnection(activeConn);
	CleanupStack::Pop();

	CloseConnection(conn2);
	CleanupStack::Pop();

	CloseConnection(conn);
	CleanupStack::Pop();

	CloseSocketServer(ss);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest302
// Test multiple monitors receive notifications from multiple interfaces
enum TVerdict TE_RConnectionTest317::doTestStepL(void)
{
	TInt err;
	TInt i;
	TInt j;		// used for nested loops

	RSocketServ ss;
	RConnection connection[ KTS317_NoofConnections ];

	RConnection monitor[ KTS317_NoofMonitors ];
	TRequestStatus status[ KTS317_NoofMonitors ];
	TInterfaceNotificationBuf info[ KTS317_NoofMonitors ];
	TInt iapId[] = {ListOfSuitableIAPs};

	err = OpenSocketServer(ss);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(ss);

	for( i = 0; i < KTS317_NoofMonitors; i++ )
		{
		err = OpenConnection(monitor[i], ss);
		TESTEL(KErrNone == err, err);
		CleanupClosePushL(monitor[i]);
		}

	for( i = 0; i < KTS317_NoofConnections; i++ )
		{
		err = OpenConnection(connection[i], ss);
		TESTEL(KErrNone == err, err);
		CleanupClosePushL(connection[i]);
		}

	// issue requests
	for( i = 0; i < KTS317_NoofMonitors; i++ )
		{
		AllInterfaceNotification(monitor[i], status[i], info[i]);
		}

	// start several different connections
	for( i = 0; i < KTS317_NoofConnections; i++ )
		{
		// the first of these should complete the initial request,
		// the remainder should fill the cache
		err = StartConnectionWithOverrides(connection[i], iapId[i]);
		if(KErrNone != err)
		    {
        	// Swallow outstanding signals
        	for(i=0;i<KTS317_NoofMonitors;i++)
        		{
        		User::WaitForAnyRequest();
        		}
		    User::Leave(err);
		    }
		}

	// all but one connection status change should be cached
	// the odd one having completed the outstanding request

	// check completed request (uncached status change)
	for( i = 0; i < KTS317_NoofMonitors; i++ )
		{
		CheckInterfaceNotificationL(status[i], info[i], EInterfaceUp, &connection[0]);
		}

	// not checking for remainder of "up" values, these will be lost by subsequent "down" values

	// close connections
	for( i = 0; i < KTS317_NoofConnections; i++ )
		{
		CloseConnection(connection[i]);
		CleanupStack::Pop();
		}

	// need to wait for interfaces to be taken down
	err = WaitForAllInterfacesToCloseL(ss);
	TESTEL(KErrNone == err, err);

	// closing connection notifications should overwrite all "up" values in cache
	for( j = 0; j < KTS317_NoofConnections; j++ )
		{
		// check for interface down...
		for( i = 0; i < KTS317_NoofMonitors; i++ )
			{
			// re-issue requests, which should complete immediately with cached status
			AllInterfaceNotification(monitor[i], status[i], info[i]);
			// check for interface down...
			CheckInterfaceNotificationL(status[i], info[i], EInterfaceDown);
			}
		} // for j

	// close monitors
	for( i = 0; i < KTS317_NoofMonitors; i++ )
		{
		CloseConnection(monitor[i]);
		CleanupStack::Pop();
		}

	CloseSocketServer(ss);
	CleanupStack::Pop();

	return TestStepResult();

} // TE_RConnectionTest317
enum TVerdict TE_RConnectionTest501::doTestStepL(void)
{
    SetTestStepResult(EFail);
    TInt err;

    RSocketServ socketServer;
    RConnection startConn;
    RConnection monitorConn;

    err = OpenSocketServer(socketServer);
    TESTEL(KErrNone == err, err);
    CleanupClosePushL(socketServer);

    err = OpenConnection(startConn, socketServer);
    TESTEL(KErrNone == err, err);
    CleanupClosePushL(startConn);

    err = OpenConnection(monitorConn, socketServer);
    TESTEL(KErrNone == err, err);
    CleanupClosePushL(monitorConn);

    // start up connection (destined to fail startup)
    TRequestStatus startStatus;
    StartConnectionAsynchronous(startConn, startStatus);

    // wait for completion of selection, after which we can attach to the connection
    TNifProgressBuf progressBuf;
    TRequestStatus progressStatus;
    ProgressNotification(startConn, progressStatus, progressBuf, KFinishedSelection);
    User::WaitForRequest(progressStatus);

    // Attach to the connection from another RConnection
    //
    // It can take a finite time from KFinishedSelection progress to the point where the
    // connection actually appears in the enumeration list, so take this into account by looping
    // waiting for the connection to enumerate.  We are only interested in obtaining the connection
    // info so that we can attach to the starting connection - we are not testing connection
    // enumeration here.

    TInt i = 0;
    TUint count;
    do
    {
        err = EnumerateConnections(startConn, count);
        TESTEL(KErrNone == err, err);
        if (count == 0)
        {
            User::After(50000);
        }
    }
    while (count == 0 && ++i <= 5);
    TESTEL(1 == count, count);

    TPckgBuf<TConnectionInfo> info;
    err = GetConnectionInfo(startConn, 1, info);
    TESTEL(KErrNone == err, err);

    err = AttachMonitor(monitorConn, info);
    TESTEL(KErrNone == err, err);

    ProgressNotification(monitorConn, progressStatus, progressBuf, KLinkLayerClosed);

    // wait for the startup to fail
    User::WaitForRequest(startStatus);
    TESTEL(KErrIfAuthenticationFailure == startStatus.Int(), startStatus.Int());

    // Wait for KLinkLayerClosed or any progress which has an error associated.  Actually,
    // we are more interested in waiting for a progress with an error than KLinkLayerClosed.
    // Use a timer to prevent waiting forever and fail with an error if the progress never arrives.
    RTimer timer;
    err = timer.CreateLocal();
    TESTEL(KErrNone == err, err);
    CleanupClosePushL(timer);

    TRequestStatus timerStatus;
    const TUint KMaxProgressWait = 5;
    timer.After(timerStatus, KMaxProgressWait * 1000000);

    User::WaitForRequest(progressStatus, timerStatus);
    if (progressStatus.Int() == KRequestPending)
    {
        // failure - timer fired
        CancelProgressNotification(monitorConn);
        User::WaitForRequest(progressStatus);
    }

    if (timerStatus.Int() == KRequestPending)
    {
        // success - progress arrived
        timer.Cancel();
        User::WaitForRequest(timerStatus);
    }
    // check that we correctly received a progress with an associated error on the RConnection
    // that attached to the underlying connection.
    TESTEL(KErrNone == progressStatus.Int(), progressStatus.Int());
    TESTEL(KErrIfAuthenticationFailure == progressBuf().iError, progressBuf().iError);
    SetTestStepResult(EPass);

    // ************************************************************************************
    // NOTE:
    // The following pause is apparently necessary to prevent WinTunnel from intermittently
    // entering an endless cpu loop and hanging the emulator.  The cause needs to be
    // investigated and fixed and then this pause can be removed.
    // ************************************************************************************
    User::After(1000000);

    CleanupStack::PopAndDestroy(&timer);
    CloseConnection(monitorConn);
    CleanupStack::Pop(&monitorConn);
    CloseConnection(startConn);
    CleanupStack::Pop(&startConn);
    CloseSocketServer(socketServer);
    CleanupStack::Pop(&socketServer);	// just sanity check our pops

    return TestStepResult();
}