Package org.browsermob.proxy

Examples of org.browsermob.proxy.ProxyServer


    @Put
    @At("/:port/whitelist")
    public Reply<?> whitelist(@Named("port") int port, Request request) {
        String regex = request.param("regex");
        int responseCode = parseResponseCode(request.param("status"));
        ProxyServer proxy = proxyManager.get(port);
        proxy.whitelistRequests(regex.split(","), responseCode);

        return Reply.saying().ok();
    }
View Full Code Here


    }

    @Post
    @At("/:port/headers")
    public Reply<?> updateHeaders(@Named("port") int port, Request request) {
        ProxyServer proxy = proxyManager.get(port);
        Map<String, String> headers = request.read(Map.class).as(Json.class);
        for (Map.Entry<String, String> entry : headers.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            proxy.addHeader(key, value);
        }
        return Reply.saying().ok();
    }
View Full Code Here

    }

    @Put
    @At("/:port/limit")
    public Reply<?> limit(@Named("port") int port, Request request) {
        ProxyServer proxy = proxyManager.get(port);
        String upstreamKbps = request.param("upstreamKbps");
        if (upstreamKbps != null) {
            try {
                proxy.setUpstreamKbps(Integer.parseInt(upstreamKbps));
            } catch (NumberFormatException e) { }
        }
        String downstreamKbps = request.param("downstreamKbps");
        if (downstreamKbps != null) {
            try {
                proxy.setDownstreamKbps(Integer.parseInt(downstreamKbps));
            } catch (NumberFormatException e) { }
        }
        String latency = request.param("latency");
        if (latency != null) {
            try {
                proxy.setLatency(Integer.parseInt(latency));
            } catch (NumberFormatException e) { }
        }
        return Reply.saying().ok();
    }
View Full Code Here

    Utils.cookieCadgerFrame.loadingRequestProgressBar.setString("Loading request into browser, please wait...");
    Utils.cookieCadgerFrame.loadingRequestProgressBar.setVisible(true);
     
    if(server == null)
    {
      server = new ProxyServer(7878);

          requestIntercept = new RequestInterceptor();
          requestIntercept.setRandomization(Integer.toString(Utils.getLocalRandomization()));
         
          try {
View Full Code Here

    WebDriverRunner.closeWebDriver();
  }

  @Before
  public void startBrowserMobProxyServer() throws Exception {
    proxyServer = new ProxyServer(findFreePort());
    proxyServer.start();
  }
View Full Code Here

        return threadLocalproxyServer.get();
    }

    private void initializeProxy(int port) throws Exception {
        setPort(port);
        threadLocalproxyServer.set(new ProxyServer(port));
        threadLocalproxyServer.get().start();
    }
View Full Code Here

TOP

Related Classes of org.browsermob.proxy.ProxyServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.