10 Replies Latest reply on Mar 17, 2010 1:44 PM by legrosb

    Socket timeout on Mac

    Anthony.R Level 2

      Hello,

       

      I am trying to run the flexunit ANT task on a Mac but keep getting the following error.

       

      [flexunit] Stopping server ...
      [flexunit] End of test data reached, sending acknowledgement to player ...
      [flexunit] Closing client connection ...
      [flexunit] Closing server on port [1024] ...

      "Socket timeout waiting for flexunit report"

       

      I see the test runner launch in Flash Player but then nothing else happens after that.  I'm assuming FlexUnit isn't able to communicate with flash player but at this point i am not sure how to remedy the problem.

       

      Does anyone have any suggestions on how to get flexunit and ANT working on a Mac?

       

      Thanks.

        • 1. Re: Socket timeout on Mac
          Simeon Bateman Level 2

          Usually this has to do with the useLocalTrusted flag not being set to true.

           

          However if you are using the 4.0.0 final this should be set to true by default.  Normally when you run the ant task it gives you output on what those properties for the FlexUnit task are.  Are you seeing those?

           

          My suggestion is make sure you are using the latest version of the libs.  Then make sure the output says useLocalTrust is true.

           

          Good Luck,

          simeon

          ps if those things dont work then attache your build output so we can try to diagnose what is going on.

          1 person found this helpful
          • 2. Re: Socket timeout on Mac
            Anthony.R Level 2

            Thanks for the help so far.  I am using the RC1 SWCs.  I've also tried different ports but that didn't help either.  The flexUnit.cfg file is getting created.

             

            This is what my flexunit task looks like (defined in a macro)...

             

                        <flexunit swf="@{bin.dir}/@{mxml.name}.swf" toDir="@{report.dir}"
                            player="flash"
                            headless="true"
                            haltonfailure="false"
                            verbose="true"
                            localTrusted="true" />

             

            And here is my build output...

             

            [flexunit] Using the following settings:
            [flexunit]     haltonfailure: [false]
            [flexunit]     headless: [true]
            [flexunit]     localTrusted: [true]
            [flexunit]     player: [flash]
            [flexunit]     port: [1024]
            [flexunit]     snapshot: [false]
            [flexunit]     snapshotFile: [---/controller/controller-shell/report/snapshot.jpg]
            [flexunit]     swf: [---/controller/controller-shell/bin/ControllerTestRunner.swf]
            [flexunit]     timeout: [60000ms]
            [flexunit]     toDir: [---/controller/controller-shell/report]
            [flexunit]     verbose: [true]
            [flexunit]     xcommand: [xvfb]
            [flexunit] Setting up server process ...
            [flexunit] Starting server ...
            [flexunit] OS: [Mac OSX]
            [flexunit] Opening server socket on port [1024].
            [flexunit] Waiting for client connection ...
            [flexunit] Launching player:
            [flexunit] Executing 'open' with arguments:
            [flexunit] '---/controller/controller-shell/bin/ControllerTestRunner.swf'
            [flexunit] The ' characters around the executable and arguments are
            [flexunit] not part of the command.
            [flexunit] Created local trust file at [/Users/arumsey/Library/Preferences/Macromedia/Flash Player/#Security/FlashPlayerTrust/flexUnit.cfg]
            [flexunit] Stopping server ...
            [flexunit] End of test data reached, sending acknowledgement to player ...
            [flexunit] Closing client connection ...
            [flexunit] Closing server on port [1024] ...

             

            BUILD FAILED
            ---/controller/build/macros.xml:64: java.util.concurrent.ExecutionException: Socket timeout waiting for flexunit report

            • 3. Re: Socket timeout on Mac
              Simeon Bateman Level 2

              Try setting your headless property to false.

               

              Since you are running on the MAC  you are in a windowed environment.  I dont think in RC1 we actually had the correct headless implementation put in place so try switching it to headless=false.

               

              Oh, and update your libraries

              • 4. Re: Socket timeout on Mac
                Simeon Bateman Level 2

                Also, I just talked to Brian Legros ( the guy that wrote the task) and he suggested making sure that the mime-type for swf is associated with the stand alone flash player.

                 

                Make sure when you double click a swf file it opens in flash player SA not in flash pro or something else.

                 

                sim

                • 5. Re: Socket timeout on Mac
                  Anthony.R Level 2

                  I've been trying a number of things and nothing has worked yet.

                   

                  I have now set...

                   

                  headless="false" on flexunit task

                  <compiler.headless-server>false</compiler.headless-server> on mxmlc task

                   

                  I've also tried using Flash Player 9 and 10 (release and debug).  I am able to double click on a SWF and have it appear in Flash Player.

                  • 6. Re: Socket timeout on Mac
                    legrosb Level 3

                    @penguinant - This may sound like a silly question, but are you using the debug plugin for a web browser, or the stand alone debug player (projector)?  When the Ant task gets to the point where it's supposed to launch the flash movie in the stand-alone player, does the player open on the screen?  Or does nothing happen?  If you don't see the standalone debug flash player pop-up when the Ant task runs, then there is a problem with your mime-type mapping.  On the Mac make sure you don't just use Open With from the context menu on a file.  The easiest way I know of mapping the SWF mime-type to the SA player, is to go to "Get Info" and then under the "Open With" section, select the player, and then click the "Change All..." button.  This should tell the OS that the mime-type for SWF files, should be opened with a particular player.

                     

                    Hope this helps.

                     

                    -Brian

                    • 7. Re: Socket timeout on Mac
                      Anthony.R Level 2

                      Hi Brian,

                       

                      I am using the stand alone player.  When the ANT task launches the SWF it

                      does appear in the standalone Flash Player on the screen.  I can see my unit

                      tests run and then eventually the flexunit task times out.

                       

                      Could it be my Mac OSX version?  I am on 10.6.2.

                       

                      Anthony

                      • 8. Re: Socket timeout on Mac
                        legrosb Level 3

                        @penguinant - Did you add the CIListener to your core in your TestRunner.mxml?  If so, could you post the code from your TestRunner.mxml, or the like, so we can look at it for more details?  If you can see your tests running that means you have the UIListener added for sure, but the UIListener will not communicate with the Ant task; only the CIListener will do that.  Let me know.

                         

                        -Brian

                        • 9. Re: Socket timeout on Mac
                          Anthony.R Level 2

                          That did it!  Thanks Brian.

                           

                          I had originally copied the libs from the Turnkey distribution so didn't have the CIListener in my build path.  I've now added the CIListener to my TestRunner MXML and am getting JUnit results generated.

                           

                          Thanks again!

                          • 10. Re: Socket timeout on Mac
                            legrosb Level 3

                            @penguinant - Just a side note, there are some good docs on using the Ant task on the FlexUnit wiki @ http://docs.flexunit.org/index.php?title=Ant_Task as well as an reference project using different build technologies and features of the Ant task @ http://github.com/blegros/flexunit/tree/master/FlexUnit4SampleCIProject/.  Definitely worth checking out if you're the Ant task to test your code and eventually moving on to any form of continuous integration.  For help with CI, check out http://docs.flexunit.org/index.php?title=Continuous_Integration_Support for some helpful tips.  I will be updating it this week with more tips on using Xvnc and the Flash Player on Linux.

                             

                            Best of luck.  Don't hesitate to ask questions.

                             

                            -Brian