void ut_cnatfwsockethandler::ut_cnatfwsockethandler_SetAddrL2L( ) { TSockAddr addr; RSocket socket; User::LeaveIfError( socket.Open( iSocketServer, KAfInet, KSockDatagram, KProtocolInetUdp ) ); socket.SetLocalPort( KTestPortUdp ); // RSocket is stubbed and currently the used ports are not stored // so we can make the next localportcall fail with this TBool shouldItFail = ETrue; socket.NextSetLocalPortShouldFail(ETrue, shouldItFail); // fails iHandler->SetMediaObserverL( this ); iHandler->SetLocalAddress( iSocketServer, iAddr ); // Will try to use same port as KTestPortUdp, but // since it's reserved, should switch to KTestPort2 NATFW_EUNIT_ASSERT_NO_LEAVE( iHandler->SetAddrL( iAddr ) ); iHandler->LocalAddress( addr ); EUNIT_ASSERT_EQUALS( KTestPort2, addr.Port() ); }