Selective Decoding and the Source Code

This is follow up post on Selective Decoding, my master thesis project. You can get the main idea of selective decoding at previous post. This post simply provides some resources related to the project.

I’ve upload two videos to YouTube demonstrating how selective decoding works.

Selective Decoding without Zoom
Selective Decoding with Zoom

The source code for the Android player is available at github. You can find it at Note that there are multiple branches, with the master branch containing the stable code and other branches having various experiments I did.

There is a research paper about selective decoding, available at If you want more detailed info, you can refer to my master thesis at

This project is part of the jiku project. There’re lots of other interesting stuff going on under the jiku project. We can refer to for more information. 

Selenium: Reuse the HTTP Session in Firefox Browser

Selenium is a browser automation framework, which can be used for automating web application testing, crawling web pages etc. For a quick start guide, one can refer to

This post gives an example of reusing an existing HTTP session in firefox browser with Selenium. The example is based on Selenium version 2.26.0.

The basic idea is to check if there’s an existing Firefox browser started by Selenium, if so, we simply connect to it and reuse the browser session.

Below is an example of using the same Firefox browser session for requesting 10 pages from Google Play. Note that the code does not work for existing Firefox browser window not started by Selenium.






import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.remote.DesiredCapabilities;

import org.openqa.selenium.remote.RemoteWebDriver;


public class FirefoxDriverReuseExample {

    private static String ROOT_URL = "";

    private static String[] appIds = new String[]{













    private static void retrieveAllUrls() {

        WebDriver driver = null;

        int cnt = 0;

        boolean isRunning = false;

        for (int i = 0; i < appIds.length; ++i) {

            String url = ROOT_URL + appIds[i];

            try {

                //see if the web driver is running

                final Socket s = new Socket();

                s.connect(new InetSocketAddress("localhost", 7055)); 


                isRunning = true; 

            } catch (IOException io) {

                isRunning = false;


            if (!isRunning) {

                //start a new session

                driver = new FirefoxDriver();


                String pageSource = driver.getPageSource();



            } else {

                //reuse the existing session

                try {

                    if (null == driver) {

                        //if not initialized yet, connect

                        driver = new RemoteWebDriver(new URL("http://localhost:7055/hub"), DesiredCapabilities.firefox()); 



                    String pageSource = driver.getPageSource();



                } catch (Exception e) {





        System.out.println("Total No. of requests and responses: " + cnt);



    public static void main(String[] args) {




Note that I used the selenium-server-standalone-2.26.0.jar as referenced library for the code. It can be found at


Selenium project page: