anchor.diff:  = Tracking tests' network statistics with Docker
   :hp-tags: browsermob-proxy, webdriver, allure, docker, harviewer, java, testng
   :published_at: 2016-07-18
  -
   ==== Browsermob Proxy Docker image
   To be able to use the following example, you'll need to build link:https://github.com/sskorol/docker-browsermob-proxy[docker-browsermob-proxy^] first. This base Docker image contains latest (2.1.1) link:https://github.com/lightbody/browsermob-proxy[Browsermob Proxy (BMP)] version.
  -
   ==== Docker configuration
   Raising newly built image would be quite simple with a help of `docker-compose`. Here's a sample BMP / Selenium Grid configuration, which will help you to link all containers together:
  -
   [source,bash]
   ----
   seleniumhub:
  
positive.code: 	return new Proxy().setHttpProxy(actualProxy).setFtpProxy(actualProxy).setSslProxy(actualProxy);
  }
  ----
  
  ==== HAR files processing
  Depending on proxy server location, network configuration and HAR size, it could take long to retrieve recorded network statistics. To avoid wasting time on HAR processing, we'll supply it async via `CompletableFuture`.
  
  [source,java]
  ----
  CompletableFuture.supplyAsync(() -> proxy.getBrowserMobProxy().getHarAsString())
  
negative.code: To simplify interaction with proxy there was created a link:https://github.com/sskorol/docker-selenium-samples/blob/master/src/main/java/com/blogspot/notes/automation/qa/core/ProxyServer.java[ProxyServer] wrapper, which allows establishing connection with a remote server. As I've mentioned above, IP address is exposed dynamically, but default port (9090) is consumed from link:https://github.com/sskorol/docker-selenium-samples/blob/master/src/test/resources/properties/config.properties[config.properties].
  
  After new BMP instance creation we need to obtain a port, which will be used by `WebDriver`. Now we're ready to send a request on HAR file creation. 
  [source,java]
  ----
  this.browserMobProxy = new BrowsermobProxyRestClient(this.ip, port);
  