コード例 #1
0
  @Test
  public void shouldCreateSimpleManagerOnRandomPort() {
    BMPCLocalManager manager = BMPCLocalLauncher.launchOnRandomPort();

    assertNotNull(manager);
    assertEquals(manager.getAPIHost(), "localhost");
    manager.stop();
  }
コード例 #2
0
  @Test
  public void shouldCreateProxy() {
    BMPCLocalManager manager = BMPCLocalLauncher.launchOnRandomPort();

    BMPCProxy proxy = manager.createProxy();

    assertNotNull(proxy);
    assertTrue(proxy.getProxyPort() > 9090);
    proxy.close();
    manager.stop();
  }
コード例 #3
0
  @Test
  public void shouldCreateProxyThatGoesThroughUpstreamProxy() {
    BMPCLocalManager manager = BMPCLocalLauncher.launchOnRandomPort();

    BMPCProxy upstreamProxy = manager.createProxy();
    BMPCProxy proxy = manager.createProxy(upstreamProxy.asHostAndPort());

    proxy.newHar();
    proxy.har();
    proxy.close();
    upstreamProxy.close();

    manager.stop();
  }
コード例 #4
0
  @Test
  public void shouldReturnListOfOpenProxies() {
    BMPCLocalManager manager = BMPCLocalLauncher.launchOnRandomPort();

    int initialProxiesCount = manager.getOpenProxies().size();
    manager.createProxy();
    manager.createProxy();
    manager.createProxy();
    manager.createProxy();
    manager.createProxy();

    assertEquals(manager.getOpenProxies().size(), initialProxiesCount + 5);

    manager.closeAll();
    assertEquals(manager.getOpenProxies().size(), 0);

    manager.stop();
  }