private void launchBrowser(
      Browser browserType,
      HttpGetEndpoint httpEP,
      PlayerEndpoint playerEP,
      RecorderEndpoint recorderEP)
      throws InterruptedException {
    try (BrowserClient browser =
        new BrowserClient.Builder().browser(browserType).client(Client.PLAYER).build()) {
      browser.setURL(httpEP.getUrl());
      browser.subscribeEvents("playing", "ended");
      playerEP.play();
      if (recorderEP != null) {
        recorderEP.record();
      }
      browser.start();

      // Assertions
      Assert.assertTrue("Timeout waiting playing event", browser.waitForEvent("playing"));
      Assert.assertTrue("Timeout waiting ended event", browser.waitForEvent("ended"));
      Assert.assertTrue(
          "Play time must be at least " + VIDEO_LENGTH + " seconds",
          browser.getCurrentTime() >= VIDEO_LENGTH);
      Assert.assertTrue(
          "The color of the video should be green", browser.colorSimilarTo(Color.GREEN));

      // Assess video/audio codec of the recorded video
      AssertMedia.assertCodecs(
          getDefaultFileForRecording(), EXPECTED_VIDEO_CODEC, EXPECTED_AUDIO_CODEC);
    }
  }
  public void doTest(Browser browserType) throws Exception {
    // Media Pipeline
    MediaPipeline mp = pipelineFactory.create();
    PlayerEndpoint playerRed =
        mp.newPlayerEndpoint("http://files.kurento.org/video/60sec/red.webm").build();
    PlayerEndpoint playerGreen =
        mp.newPlayerEndpoint("http://files.kurento.org/video/60sec/green.webm").build();
    PlayerEndpoint playerBlue =
        mp.newPlayerEndpoint("http://files.kurento.org/video/60sec/blue.webm").build();
    PlayerEndpoint playerWhite =
        mp.newPlayerEndpoint("http://files.kurento.org/video/60sec/white.webm").build();

    Composite composite = mp.newComposite().build();
    HubPort hubPort1 = composite.newHubPort().build();
    HubPort hubPort2 = composite.newHubPort().build();
    HubPort hubPort3 = composite.newHubPort().build();
    HubPort hubPort4 = composite.newHubPort().build();
    HubPort hubPort5 = composite.newHubPort().build();

    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS().build();
    playerRed.connect(hubPort1);
    playerGreen.connect(hubPort2);
    playerBlue.connect(hubPort3);
    playerWhite.connect(hubPort4);

    hubPort5.connect(httpEP);

    // Test execution
    try (BrowserClient browser =
        new BrowserClient.Builder().browser(browserType).client(Client.PLAYER).build()) {
      browser.setURL(httpEP.getUrl());
      browser.subscribeEvents("playing");
      playerRed.play();
      playerGreen.play();
      playerBlue.play();
      playerWhite.play();
      browser.start();

      // Assertions
      Assert.assertTrue("Timeout waiting playing event", browser.waitForEvent("playing"));
      Assert.assertTrue(
          "Upper left part of the video must be red", browser.color(Color.RED, 10, 0, 0));
      Assert.assertTrue(
          "Upper right part of the video must be green", browser.color(Color.GREEN, 11, 450, 0));
      Assert.assertTrue(
          "Lower left part of the video must be blue", browser.color(Color.BLUE, 12, 0, 450));
      Assert.assertTrue(
          "Lower right part of the video must be white", browser.color(Color.WHITE, 13, 450, 450));
    }
  }