当前位置: 首页>>代码示例>>Java>>正文


Java ProxyServer.stop方法代码示例

本文整理汇总了Java中net.lightbody.bmp.proxy.ProxyServer.stop方法的典型用法代码示例。如果您正苦于以下问题:Java ProxyServer.stop方法的具体用法?Java ProxyServer.stop怎么用?Java ProxyServer.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.lightbody.bmp.proxy.ProxyServer的用法示例。


在下文中一共展示了ProxyServer.stop方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: strippingReferer

import net.lightbody.bmp.proxy.ProxyServer; //导入方法依赖的package包/类
@Test
public void strippingReferer() throws Exception {
  ProxyServer bmp = new ProxyServer(8071);
  bmp.start();

  HttpRequestInterceptor stripper = new RefererStripper();
  bmp.addRequestInterceptor(stripper);

  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.PROXY, bmp.seleniumProxy());

  WebDriver driver = new FirefoxDriver(caps);

  driver.get("http://localhost/test_referer.html");
  driver.findElement(By.tagName("a")).click();

  assertThat(
      driver.findElement(By.tagName("body")).getText(),
      containsString("No referer"));

  Thread.sleep(10000);

  driver.quit();

  bmp.stop();
}
 
开发者ID:barancev,项目名称:selen-confetqa-2013,代码行数:27,代码来源:Sample6_StrippingReferer.java

示例2: startWithProxy

import net.lightbody.bmp.proxy.ProxyServer; //导入方法依赖的package包/类
@Test
public void startWithProxy() throws Exception {
  ProxyServer bmp = new ProxyServer(8071);
  bmp.start();

  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.PROXY, bmp.seleniumProxy());

  WebDriver driver = new FirefoxDriver(caps);

  driver.get("http://localhost/");
  assertThat(
      driver.findElement(By.tagName("body")).getText(),
      containsString("WampServer"));

  driver.quit();

  bmp.stop();
}
 
开发者ID:barancev,项目名称:selen-confetqa-2013,代码行数:20,代码来源:Sample1_StartWithProxy.java

示例3: downloadingFiles

import net.lightbody.bmp.proxy.ProxyServer; //导入方法依赖的package包/类
@Test
public void downloadingFiles() throws Exception {
  ProxyServer bmp = new ProxyServer(8071);
  bmp.start();

  HttpResponseInterceptor downloader = new FileDownloader()
      .addContentType("application/pdf");
  bmp.addResponseInterceptor(downloader);

  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.PROXY, bmp.seleniumProxy());

  WebDriver driver = new FirefoxDriver(caps);

  driver.get("http://localhost/test_download.html");
  driver.findElement(By.tagName("a")).click();

  String fileName = driver.findElement(By.tagName("body")).getText();
  assertTrue(new File(fileName).exists());

  Thread.sleep(30000);

  driver.quit();

  bmp.stop();
}
 
开发者ID:barancev,项目名称:selen-confetqa-2013,代码行数:27,代码来源:Sample8_DownloadingFiles.java

示例4: injectingJavaScript

import net.lightbody.bmp.proxy.ProxyServer; //导入方法依赖的package包/类
@Test
public void injectingJavaScript() throws Exception {
  ProxyServer bmp = new ProxyServer(8071);
  bmp.start();

  HttpResponseInterceptor injector = new JQueryInjector();
  bmp.addResponseInterceptor(injector);

  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.PROXY, bmp.seleniumProxy());

  FirefoxDriver driver = new FirefoxDriver(caps);

  driver.get("http://localhost/test_referer.html");
  String linkText = (String) driver.executeScript("return $(\"a\").text()");

  assertThat(
      linkText,
      is("click me!"));

  driver.quit();

  bmp.stop();
}
 
开发者ID:barancev,项目名称:selen-confetqa-2013,代码行数:25,代码来源:Sample7_InjectingJavaScript.java

示例5: autoBasicAuthorization

import net.lightbody.bmp.proxy.ProxyServer; //导入方法依赖的package包/类
@Test
public void autoBasicAuthorization() throws Exception {
  ProxyServer bmp = new ProxyServer(8071);
  bmp.start();

  bmp.autoBasicAuthorization("", "admin", "password");

  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.PROXY, bmp.seleniumProxy());

  WebDriver driver = new FirefoxDriver(caps);

  driver.get("http://localhost/restricted");
  assertThat(
      driver.findElement(By.tagName("body")).getText(),
      containsString("Access granted"));

  driver.quit();

  bmp.stop();
}
 
开发者ID:barancev,项目名称:selen-confetqa-2013,代码行数:22,代码来源:Sample2_Authentication.java

示例6: changingUserAgent

import net.lightbody.bmp.proxy.ProxyServer; //导入方法依赖的package包/类
@Test
public void changingUserAgent() throws Exception {
  ProxyServer bmp = new ProxyServer(8071);
  bmp.start();

  RequestInterceptor userAgentChanger = new UserAgentChanger(
      "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91)"
          + "AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
  bmp.addRequestInterceptor(userAgentChanger);

  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.PROXY, bmp.seleniumProxy());

  WebDriver driver = new FirefoxDriver(caps);

  driver.get("http://software-testing.ru/forum");
  Thread.sleep(10000);

  driver.quit();

  bmp.stop();
}
 
开发者ID:barancev,项目名称:selen-confetqa-2013,代码行数:23,代码来源:Sample4_ChangingUserAgent.java

示例7: changingLanguage

import net.lightbody.bmp.proxy.ProxyServer; //导入方法依赖的package包/类
@Test
public void changingLanguage() throws Exception {
  ProxyServer bmp = new ProxyServer(8071);
  bmp.start();

  RequestInterceptor languageChanger = new LanguageChanger("en,ru");
  bmp.addRequestInterceptor(languageChanger);

  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.PROXY, bmp.seleniumProxy());

  WebDriver driver = new FirefoxDriver(caps);

  driver.get("http://ci.seleniumhq.org:8080/");
  Thread.sleep(10000);

  driver.quit();

  bmp.stop();
}
 
开发者ID:barancev,项目名称:selen-confetqa-2013,代码行数:21,代码来源:Sample5_ChangingLanguage.java

示例8: stopServer

import net.lightbody.bmp.proxy.ProxyServer; //导入方法依赖的package包/类
/**
 * Stops proxy server
 * @param server
 * @return
 * @throws Exception
 */
public PerformanceUtils stopServer(ProxyServer server){
    try {
        server.stop();
    } catch (Exception e) {
       log.error("Exception while trying to stop proxy server {}",e.getMessage());
    }
    return this;
}
 
开发者ID:GiannisPapadakis,项目名称:seletest,代码行数:15,代码来源:PerformanceUtils.java

示例9: gettingHar

import net.lightbody.bmp.proxy.ProxyServer; //导入方法依赖的package包/类
@Test
public void gettingHar() throws Exception {
  ProxyServer bmp = new ProxyServer(8071);
  bmp.start();

  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.PROXY, bmp.seleniumProxy());

  WebDriver driver = new FirefoxDriver(caps);

  bmp.newHar("localhost");

  driver.get("http://localhost/");

  Har har = bmp.getHar();

  for (HarEntry entry : har.getLog().getEntries()) {
    HarRequest request = entry.getRequest();
    HarResponse response = entry.getResponse();

    System.out.println(request.getUrl() + " : " + response.getStatus()
        + ", " + entry.getTime() + "ms");

    assertThat(response.getStatus(), is(200));
  }

  driver.quit();

  bmp.stop();
}
 
开发者ID:barancev,项目名称:selen-confetqa-2013,代码行数:31,代码来源:Sample3_GettingHar.java


注:本文中的net.lightbody.bmp.proxy.ProxyServer.stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。