natfw/natfwconnectionmultiplexer/tsrc/muxtestconsole/src/multiplexertcptests.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32debug.h>
       
    23 #include "natfwconnectivityapidefs.h"
       
    24 #include <mmccinterface.h>
       
    25 #include <mmcccodecinformation.h>
       
    26 #include "cncmconnectionmultiplexer.h"
       
    27 
       
    28 #include "testdefinitions.hrh"
       
    29 #include "ncmconnectionmultiplexerlogs.h"
       
    30 #include "cncmportstore.h"
       
    31 #include "natfwsocketmediaconnwrapper.h"
       
    32 #include "muxtestconsolestubs.h"
       
    33 #include "multiplexertcptests.h"
       
    34 
       
    35 
       
    36 #ifndef __WINSCW__
       
    37 const TInt KTestIapId = 1;
       
    38 #else
       
    39 const TInt KTestIapId = 6;
       
    40 #endif
       
    41 
       
    42 const TInt KAudioPrefVoipAudioUplink           = 0x05220001;
       
    43 const TInt KAudioPrefVoipAudioUplinkNonSignal  = 0x05230001;
       
    44 const TInt KAudioPrefVoipAudioDownlink         = 0x05210001;
       
    45 const TInt KAudioDTMFString                    = 0x00150001;
       
    46 const TInt KAudioPriorityDTMFString            = 45;
       
    47 
       
    48 const TInt KDefaultQos = 46;
       
    49 _LIT8(KUDPMessage,"UDP_Message"); 
       
    50 
       
    51 const TUint KMediaConnection = 1;
       
    52 
       
    53 // ======== MEMBER FUNCTIONS =================================================
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // CMultiplexerTcpTestsInterface::CMultiplexerTcpTestsInterface
       
    57 // C++ default constructor can NOT contain any code, that
       
    58 // might leave.
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 CMultiplexerTcpTests::CMultiplexerTcpTests( CConsoleBase& aConsole,
       
    62     CNcmConnectionMultiplexer& aMux, CMuxTestConsoleStubs& aIFStub ) :
       
    63     iConsole( aConsole ), iMux( aMux ), iIfStub( aIFStub )
       
    64     {
       
    65     }
       
    66     
       
    67 // ---------------------------------------------------------------------------
       
    68 // CMultiplexerTcpTests::ConstructL
       
    69 // Symbian 2nd phase constructor can leave.
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 void CMultiplexerTcpTests::ConstructL()
       
    73     {
       
    74     // Dummy 'cause first uheap marking
       
    75     TUint sessionId( 0 );
       
    76     TUint streamId( 0 );
       
    77 
       
    78     sessionId = iMux.CreateSessionL( KTestIapId, 5500, 10000 );
       
    79     CActiveScheduler::Start();
       
    80     
       
    81     streamId = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetUdp );
       
    82     
       
    83     iMux.RegisterIncomingConnectionObserverL( streamId, iIfStub ); 
       
    84     
       
    85     TUint sub = iMux.CreateConnectionL( streamId, KAfInet );
       
    86     iMux.UnregisterIncomingConnectionObserverL( streamId, iIfStub );
       
    87     iMux.RemoveSessionL( sessionId );
       
    88     }
       
    89     
       
    90 // ---------------------------------------------------------------------------
       
    91 // CMultiplexerTcpTests::NewL
       
    92 // Static constructor.
       
    93 // ---------------------------------------------------------------------------
       
    94 //   
       
    95 CMultiplexerTcpTests* CMultiplexerTcpTests::NewL( CConsoleBase& aConsole,
       
    96     CNcmConnectionMultiplexer& aMux, CMuxTestConsoleStubs& aIFStub )
       
    97     {
       
    98     CMultiplexerTcpTests* self 
       
    99         = new ( ELeave ) CMultiplexerTcpTests( aConsole, aMux, aIFStub );
       
   100 
       
   101     CleanupStack::PushL( self );
       
   102     self->ConstructL();
       
   103     CleanupStack::Pop( self );
       
   104     return self;
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CMultiplexerTcpTests::~CMultiplexerTcpTests
       
   109 // Destructor.
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 CMultiplexerTcpTests::~CMultiplexerTcpTests()
       
   113     {
       
   114     }
       
   115 
       
   116  void CMultiplexerTcpTests::DoRunTcpMuxTestsL()
       
   117     {
       
   118     iConsole.ClearScreen();
       
   119     iConsole.Printf( _L("\n*** MUX TESTS ***\n") );
       
   120     
       
   121     TInt err( KErrNone );
       
   122 
       
   123     iConsole.Printf( _L("Create session test\n") );
       
   124     RDebug::Print( _L("MUX_TEST_START: TestCreateSessionL") );
       
   125     //__UHEAP_MARK;
       
   126     TRAP( err, TestCreateSessionL() );
       
   127     //__UHEAP_MARKEND;
       
   128     RDebug::Print( _L("MUX_TEST_STOP: TestCreateSessionL, ERR: %d"), err );
       
   129 
       
   130     // Check again with memory leak check
       
   131     iConsole.Printf( _L("Create session test\n") );
       
   132     RDebug::Print( _L("MUX_TEST_START: TestCreateSessionL") );
       
   133     __UHEAP_MARK;
       
   134     TRAP( err, TestCreateSessionL() );
       
   135     __UHEAP_MARKEND;
       
   136     RDebug::Print( _L("MUX_TEST_STOP: TestCreateSessionL, ERR: %d"), err );
       
   137     
       
   138     err = KErrNone;
       
   139     RDebug::Print( _L("MUX_TEST_START: TestCreateStreamL") );
       
   140     iConsole.Printf( _L("Create stream test\n") );
       
   141     __UHEAP_MARK;
       
   142     TRAP( err, TestCreateStreamL() );
       
   143     __UHEAP_MARKEND;
       
   144     RDebug::Print( _L("MUX_TEST_STOP: TestCreateStreamL, ERR: %d"), err );
       
   145 
       
   146     err = KErrNone;
       
   147     RDebug::Print( _L("MUX_TEST_START: TestCreateConnectionL") );
       
   148     iConsole.Printf( _L("Create connection test\n") );
       
   149     __UHEAP_MARK;
       
   150     TRAP( err, TestCreateConnectionL() );
       
   151     __UHEAP_MARKEND;
       
   152     RDebug::Print( _L("MUX_TEST_STOP: TestCreateConnectionL, ERR: %d"), err );
       
   153  
       
   154     err = KErrNone;
       
   155     RDebug::Print( _L("MUX_TEST_START: TestConnectTcpConnectionsL") );
       
   156     iConsole.Printf( _L("Connect TCP connections test\n") );
       
   157     //__UHEAP_MARK;
       
   158     TRAP( err, TestConnectTcpConnectionsL() );
       
   159     //__UHEAP_MARKEND;
       
   160     RDebug::Print( _L("MUX_TEST_STOP: TestConnectTcpConnectionsL, ERR: %d"), err );
       
   161 
       
   162     // Check again with memory leak check
       
   163     err = KErrNone;
       
   164     RDebug::Print( _L("MUX_TEST_START: TestConnectTcpConnectionsL") );
       
   165     iConsole.Printf( _L("Connect TCP connections test\n") );
       
   166     __UHEAP_MARK;
       
   167     TRAP( err, TestConnectTcpConnectionsL() );
       
   168     __UHEAP_MARKEND;
       
   169     RDebug::Print( _L("MUX_TEST_STOP: TestConnectTcpConnectionsL, ERR: %d"), err );
       
   170     
       
   171     err = KErrNone;
       
   172     RDebug::Print( _L("MUX_TEST_START: TestActivateStunTcpMediaConnectionsL") );
       
   173     iConsole.Printf( _L("Activate STUN TCP MEDIA test\n") );
       
   174     __UHEAP_MARK;
       
   175     TRAP( err, TestActivateStunTcpMediaConnectionsL() );
       
   176     __UHEAP_MARKEND;
       
   177     RDebug::Print( _L("MUX_TEST_STOP: TestActivateStunTcpMediaConnectionsL, ERR: %d"), err );    
       
   178     }
       
   179       
       
   180 // ---------------------------------------------------------------------------
       
   181 // CMultiplexerTcpTests::TestCreateSessionL
       
   182 // ---------------------------------------------------------------------------
       
   183 //
       
   184 void CMultiplexerTcpTests::TestCreateSessionL()
       
   185     {
       
   186     TUint sessionId( 0 );
       
   187     
       
   188     sessionId = iMux.CreateSessionL( KTestIapId, 5000, 8000 );
       
   189     CActiveScheduler::Start();
       
   190     
       
   191     iMux.RemoveSessionL( sessionId );
       
   192     
       
   193     sessionId = iMux.CreateSessionL( KTestIapId, 5000, 8000 );
       
   194     iMux.RemoveSessionL( sessionId );
       
   195     }
       
   196 
       
   197     
       
   198 // ---------------------------------------------------------------------------
       
   199 // CMultiplexerTcpTests::TestCreateSessionL
       
   200 // ---------------------------------------------------------------------------
       
   201 //
       
   202 void CMultiplexerTcpTests::TestCreateStreamL()
       
   203     {
       
   204     TUint sessionId( 0 );
       
   205     TUint sessionId2( 0 );
       
   206     TUint streamId( 0 );
       
   207     TUint streamId2( 0 );  
       
   208     
       
   209     sessionId = iMux.CreateSessionL( KTestIapId, 5000, 8000 ); 
       
   210     CActiveScheduler::Start();
       
   211 
       
   212         
       
   213     streamId = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );
       
   214     streamId2 = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );
       
   215       
       
   216     iMux.RemoveStreamL( streamId ); 
       
   217     iMux.RemoveStreamL( streamId2 );
       
   218 
       
   219     streamId = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );
       
   220     
       
   221     iMux.RegisterIncomingConnectionObserverL( streamId, iIfStub );
       
   222     iMux.RegisterIncomingConnectionObserverL( streamId, iIfStub );
       
   223     
       
   224     streamId2 = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );
       
   225     
       
   226     iMux.RemoveStreamL( streamId );
       
   227     iMux.RemoveSessionL( sessionId );
       
   228     iMux.RemoveSessionL( sessionId2 );
       
   229     }
       
   230 
       
   231 // ---------------------------------------------------------------------------
       
   232 // CMultiplexerTcpTests::TestCreateConnectionL
       
   233 // ---------------------------------------------------------------------------
       
   234 //
       
   235 void CMultiplexerTcpTests::TestCreateConnectionL()
       
   236     {
       
   237     TUint sessionId( 0 );
       
   238     
       
   239     TUint streamId( 0 );
       
   240     TUint streamId2( 0 );
       
   241       
       
   242     TUint connectionId( 0 );
       
   243     TUint connectionId2( 0 );
       
   244     TUint connectionId3( 0 );
       
   245     TUint connectionId4( 0 );
       
   246     TUint connectionId5( 0 );
       
   247     
       
   248     sessionId = iMux.CreateSessionL( KTestIapId, 5000, 8000 );
       
   249     CActiveScheduler::Start();
       
   250     
       
   251     streamId = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );
       
   252     streamId2 = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );
       
   253     
       
   254     iMux.RegisterIncomingConnectionObserverL(streamId, iIfStub );
       
   255   
       
   256     connectionId = iMux.CreateConnectionL( streamId, KAfInet );
       
   257     connectionId2 = iMux.CreateConnectionL( streamId, KAfInet );  
       
   258     connectionId3 = iMux.CreateConnectionL( streamId2, KAfInet );
       
   259     
       
   260     // New connection, Reuse local address
       
   261     TInetAddr connectionAddr = iMux.LocalIPAddressL( streamId, connectionId2 );
       
   262     connectionId4 = iMux.CreateConnectionL( streamId2, connectionAddr );  
       
   263     // Check success of address reuse
       
   264     TInetAddr connectionAddr2 = iMux.LocalIPAddressL( streamId, connectionId4 );
       
   265     ASSERT( connectionAddr.CmpAddr( connectionAddr2 ) );
       
   266     
       
   267     
       
   268     // New connection, Reuse local address
       
   269     TInetAddr connectionAddr3 = iMux.LocalIPAddressL( streamId, connectionId3 );
       
   270     connectionId5 = iMux.CreateConnectionL( streamId2, connectionAddr3 );
       
   271     // Check success of address reuse
       
   272     TInetAddr connectionAddr5 = iMux.LocalIPAddressL( streamId2, connectionId5 );    
       
   273     ASSERT( connectionAddr3.CmpAddr( connectionAddr5 ) );    
       
   274     
       
   275     // New connection, Reuse local address
       
   276     connectionAddr3 = iMux.LocalIPAddressL( streamId, connectionId3 );
       
   277     connectionId5 = iMux.CreateConnectionL( streamId2, connectionAddr3 );
       
   278     // Check success of address reuse
       
   279     connectionAddr5 = iMux.LocalIPAddressL( streamId2, connectionId5 );    
       
   280     ASSERT( connectionAddr3.CmpAddr( connectionAddr5 ) );  
       
   281         
       
   282     iMux.RemoveConnectionL( streamId2, connectionId5 );
       
   283     iMux.RemoveConnectionL( streamId, connectionId3 );
       
   284     iMux.RemoveStreamL( streamId );
       
   285     iMux.RemoveSessionL( sessionId ); 
       
   286     }
       
   287 
       
   288   
       
   289 // ---------------------------------------------------------------------------
       
   290 // CMultiplexerUdpTests::TestConnectTcpConnectionsL
       
   291 // ---------------------------------------------------------------------------
       
   292 //
       
   293 void CMultiplexerTcpTests::TestConnectTcpConnectionsL()
       
   294     {
       
   295     TUint sessionId( 0 );
       
   296     
       
   297     TUint streamId( 0 );
       
   298     TUint streamId2( 0 );
       
   299       
       
   300     TUint connectionId( 0 );
       
   301     TUint connectionId2( 0 );
       
   302     TUint connectionId3( 0 );
       
   303     
       
   304  
       
   305     // Create 1 session, 1 stream, 1 connection
       
   306     sessionId = iMux.CreateSessionL( KTestIapId, 8000, 11000 );
       
   307     CActiveScheduler::Start();  
       
   308     
       
   309     streamId = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );
       
   310     streamId2 = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );     
       
   311     connectionId = iMux.CreateConnectionL( streamId, KAfInet ); 
       
   312     connectionId2 = iMux.CreateConnectionL( streamId2, KAfInet );
       
   313         
       
   314     // Address resolving
       
   315     TInetAddr connectionAddr( iMux.LocalIPAddressL( streamId, connectionId ) );
       
   316     TInetAddr connectionAddr2( iMux.LocalIPAddressL( streamId2, connectionId2 ) );    
       
   317     
       
   318     iMux.RegisterConnectionObserverL( streamId, iIfStub );
       
   319     iMux.RegisterConnectionObserverL( streamId2, iIfStub );    
       
   320   
       
   321     iMux.OpenTcpConnectionL( streamId, connectionId, ETcpSetupActive, connectionAddr2 ); 
       
   322     iMux.OpenTcpConnectionL( streamId2, connectionId2, ETcpSetupActive, connectionAddr );
       
   323     CActiveScheduler::Start(); 
       
   324     CActiveScheduler::Start();    
       
   325 
       
   326     iMux.CloseTcpConnection( streamId, connectionId );
       
   327     iMux.CloseTcpConnection( streamId2, connectionId2 );
       
   328     
       
   329     iMux.OpenTcpConnectionL( streamId, connectionId, ETcpSetupPassive, connectionAddr2 ); 
       
   330     iMux.OpenTcpConnectionL( streamId2, connectionId2, ETcpSetupActive, connectionAddr );
       
   331     CActiveScheduler::Start(); 
       
   332     CActiveScheduler::Start();
       
   333  
       
   334     iMux.CloseTcpConnection( streamId, connectionId );
       
   335     iMux.CloseTcpConnection( streamId2, connectionId2 );
       
   336     
       
   337     iMux.OpenTcpConnectionL( streamId2, connectionId2, ETcpSetupActive, connectionAddr );
       
   338     iMux.OpenTcpConnectionL( streamId, connectionId, ETcpSetupPassive, connectionAddr2 );
       
   339     CActiveScheduler::Start(); 
       
   340     CActiveScheduler::Start();
       
   341     
       
   342     iMux.CloseTcpConnection( streamId, connectionId );
       
   343     iMux.CloseTcpConnection( streamId2, connectionId2 ); 
       
   344        
       
   345     // Cancel the connection process
       
   346     iMux.OpenTcpConnectionL( streamId, connectionId, ETcpSetupPassive, connectionAddr2 );    
       
   347     iMux.CloseTcpConnection( streamId, connectionId );
       
   348     CActiveScheduler::Start();
       
   349     
       
   350     iMux.OpenTcpConnectionL( streamId, connectionId, ETcpSetupPassive, connectionAddr2 );    
       
   351     iMux.CloseTcpConnection( streamId, connectionId );
       
   352     CActiveScheduler::Start();  
       
   353     iMux.RemoveSessionL( sessionId );
       
   354     }
       
   355 
       
   356 
       
   357 
       
   358 // ---------------------------------------------------------------------------
       
   359 // CMultiplexerTcpTests::TestActivateStunTcpMediaConnectionsL
       
   360 // ---------------------------------------------------------------------------
       
   361 //
       
   362 void CMultiplexerTcpTests::TestActivateStunTcpMediaConnectionsL()
       
   363     {
       
   364     TUint sessionId( 0 );
       
   365     
       
   366     TUint streamId( 0 );
       
   367     TUint streamId2( 0 );
       
   368       
       
   369     TUint connectionId( 0 );
       
   370     TUint connectionId2( 0 );
       
   371     TUint connectionId3( 0 );
       
   372     
       
   373     sessionId = iMux.CreateSessionL( KTestIapId, 5000, 8000 );
       
   374     CActiveScheduler::Start();
       
   375     
       
   376     streamId = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );
       
   377     streamId2 = iMux.CreateStreamL( sessionId, KDefaultQos, KProtocolInetTcp );
       
   378     
       
   379     // Simulate UDP fetch candidate    
       
   380     iMux.RegisterIncomingConnectionObserverL( streamId, iIfStub );
       
   381     iMux.RegisterConnectionObserverL( streamId, iIfStub );
       
   382     iMux.RegisterConnectionObserverL( streamId2, iIfStub );
       
   383     connectionId = iMux.CreateConnectionL( streamId, KAfInet );
       
   384     
       
   385     // Test connection
       
   386     connectionId2 = iMux.CreateConnectionL( streamId2, KAfInet );  
       
   387     TInetAddr connectionAddress2( iMux.LocalIPAddressL( streamId2, connectionId2 ) );
       
   388 
       
   389     // Test connection, SERVER
       
   390     connectionId3 = iMux.CreateConnectionL( streamId2, KAfInet );  
       
   391     TInetAddr connectionAddress3( iMux.LocalIPAddressL( streamId2, connectionId3 ) );
       
   392     
       
   393     /**** setup wrapper *****/
       
   394     CNATFWSocketMediaConnWrapper* mediaWrapper = CNATFWSocketMediaConnWrapper::NewL(
       
   395              iMux.PortStoreL( sessionId ).Port(), KProtocolInetUdp, streamId );
       
   396        
       
   397     iMux.RegisterMediaWrapperL( mediaWrapper );
       
   398             
       
   399     TInetAddr destinationAddress;    
       
   400     mediaWrapper->OutgoingAddr( destinationAddress );    
       
   401     __CONNECTIONMULTIPLEXER_ADDRLOG( "CMultiplexerUdpTests::TestUdpAudioL- Wrapper LOCAL ADDRESS: ", destinationAddress )
       
   402 
       
   403     
       
   404     mediaWrapper->SetIncomingAddrL( destinationAddress );
       
   405     //TODO connect connection 2 to wrapper and start wrapper receiving
       
   406     /**************************/
       
   407 
       
   408     // Dummy address
       
   409     TInetAddr stunServerAddress;
       
   410     stunServerAddress.SetAddress( INET_ADDR( 10,36,7,6 ) );
       
   411     stunServerAddress.SetPort( 3478 );
       
   412    
       
   413     // STUN-plugin connects connection to stun server
       
   414     iMux.OpenTcpConnectionL( streamId2, connectionId3, ETcpSetupPassive, stunServerAddress );  // Server
       
   415     iMux.OpenTcpConnectionL( streamId, connectionId, ETcpSetupActive, connectionAddress3 );
       
   416     CActiveScheduler::Start();   
       
   417     CActiveScheduler::Start(); 
       
   418     
       
   419     iMux.SetReceivingStateL( streamId, connectionId, EStreamingStateActive );
       
   420     iMux.SetSendingStateL( streamId, connectionId, stunServerAddress, EStreamingStateActive );
       
   421     iMux.SetReceivingStateL( streamId2, connectionId3, EStreamingStateActive );
       
   422     CActiveScheduler::Start();  
       
   423     CActiveScheduler::Start();    
       
   424     CActiveScheduler::Start();
       
   425     
       
   426     // Binding request
       
   427     _LIT8(KUDPMessage,"UDP_Binding_Request");
       
   428     iMux.SendL( streamId, connectionId, KUDPMessage, NULL );
       
   429     
       
   430    
       
   431     // STUN plugin, reuse connection.. connect to peer address
       
   432     iMux.CloseTcpConnection( streamId, connectionId );  // Connection to STUN server
       
   433     CActiveScheduler::Start(); 
       
   434         
       
   435     iMux.OpenTcpConnectionL( streamId2, connectionId2, ETcpSetupPassive, stunServerAddress );  // Remote end
       
   436     iMux.OpenTcpConnectionL( streamId, connectionId, ETcpSetupActive, connectionAddress2 );   
       
   437     CActiveScheduler::Start();     
       
   438     CActiveScheduler::Start();      
       
   439     
       
   440     // Remote end
       
   441          
       
   442     TInetAddr connectionAddress( iMux.LocalIPAddressL( streamId, connectionId ) );
       
   443     iMux.SetSendingStateL( streamId2, connectionId2, connectionAddress, EStreamingStateActive );
       
   444     CActiveScheduler::Start();
       
   445     
       
   446     
       
   447     // Setup media flow to peer
       
   448     // NATFW client
       
   449     iMux.SetReceivingStateL( streamId, connectionId, EStreamingStateActive );
       
   450     iMux.SetReceivingStateForMediaL( streamId, connectionId, EStreamingStateActive );
       
   451     CActiveScheduler::Start();
       
   452     CActiveScheduler::Start();
       
   453     
       
   454     // NATFW client
       
   455     iMux.SetSendingStateL( streamId, connectionId, connectionAddress2, EStreamingStateActive );;
       
   456     iMux.SetSendingStateForMediaL( streamId, connectionId, EStreamingStateActive );
       
   457     CActiveScheduler::Start(); 
       
   458     CActiveScheduler::Start(); 
       
   459 
       
   460 
       
   461     // Set sending again
       
   462     iMux.SetSendingStateL( streamId, connectionId, connectionAddress2, EStreamingStateActive );
       
   463     CActiveScheduler::Start(); 
       
   464     iMux.SetSendingStateL( streamId, connectionId, connectionAddress2, EStreamingStateActive );
       
   465     CActiveScheduler::Start(); 
       
   466            
       
   467     // Set receiving again
       
   468     iMux.SetReceivingStateL( streamId, connectionId, EStreamingStateActive );
       
   469     CActiveScheduler::Start();
       
   470     iMux.SetReceivingStateL( streamId, connectionId, EStreamingStateActive );
       
   471     CActiveScheduler::Start(); 
       
   472     
       
   473     iMux.SendL( streamId2, connectionId2, KUDPMessage, &iIfStub );
       
   474     iMux.SendL( streamId2, connectionId2, KUDPMessage, connectionAddress2, &iIfStub );
       
   475     CActiveScheduler::Start(); 
       
   476     CActiveScheduler::Start();
       
   477     
       
   478     iMux.CloseTcpConnection( streamId, connectionId );  // Connection to STUN server   
       
   479     iMux.RemoveSessionL( sessionId );  
       
   480     }