@Test public void shouldCreateSimpleManagerOnRandomPort() { BMPCLocalManager manager = BMPCLocalLauncher.launchOnRandomPort(); assertNotNull(manager); assertEquals(manager.getAPIHost(), "localhost"); manager.stop(); }
@Test public void shouldCreateProxy() { BMPCLocalManager manager = BMPCLocalLauncher.launchOnRandomPort(); BMPCProxy proxy = manager.createProxy(); assertNotNull(proxy); assertTrue(proxy.getProxyPort() > 9090); proxy.close(); manager.stop(); }
@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(); }
@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(); }
@BeforeClass public void startLocalBMP() { BMPCLocalLauncher.install(); }