GithubHelp home page GithubHelp logo

Comments (12)

nasis avatar nasis commented on June 5, 2024

I'm having exactly the same problem. Sample code when used with WebDriver. I've tested that both on 4.0 and 5.0 SNAPSHOT

public class GroupExample {

public static void main(String[] args) throws InterruptedException {

    int port = 9090;
    HttpProxyServer proxyServer = new DefaultHttpProxyServer(port);
    proxyServer.start();

    Proxy proxy = new Proxy();
    proxy.setProxyType(Proxy.ProxyType.MANUAL);
    String proxyStr = String.format("localhost:%d", port);
    proxy.setHttpProxy(proxyStr);
    proxy.setSslProxy(proxyStr);

    DesiredCapabilities capability = DesiredCapabilities.firefox();
    capability.setCapability(CapabilityType.PROXY, proxy);

    String urlString = "http://www.yahoo.com/";
    WebDriver driver = new FirefoxDriver(capability);
    driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);

    driver.get(urlString);

    driver.close();
    System.out.println("Driver closed");

    proxyServer.stop();
    System.out.println("Proxy stopped");
}

}

from littleproxy.

isopov avatar isopov commented on June 5, 2024

nasis, I used http://code.google.com/p/proxoid/source/browse/trunk/#trunk%2Fproxylight%2Fsrc%2Fcom%2Fmba%2Fproxylight proxy for tests. Maybe it can be useful to you too.

from littleproxy.

nasis avatar nasis commented on June 5, 2024

Thanks. It looks to simple though. I need to record the resources content as well. Looks like I'll need to add lots more code.

from littleproxy.

myleshorton avatar myleshorton commented on June 5, 2024

I'm not able to reproduce this with the 0.5-SNAPSHOT guys. I added the commits under #37 by mistake, but basically converted your tests to junit in EndToEndStoppingTest.java. Both the HttpClient version and the WebDriver version stop fine in those tests.

from littleproxy.

nasis avatar nasis commented on June 5, 2024

Why no try the main program as it is without JUnit?
Lets see how that goes.
Where you able to reproduce it on 0.4? Probably the same issue.

On Wed, Aug 29, 2012 at 10:23 PM, myleshorton [email protected]:

I'm not able to reproduce this with the 0.5-SNAPSHOT guys. I added the
commits under #37 #37 by
mistake, but basically converted your tests to junit in
EndToEndStoppingTest.java. Both the HttpClient version and the WebDriver
version stop fine in those tests.


Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-8137734.

from littleproxy.

isopov avatar isopov commented on June 5, 2024

I have debugged your Unit Test. The problem is present there, but is not visible. What is going on, if we run Unit tests:

  1. First test creates Proxy and stops it. But several non-daemon threads are left after this proxy.
  2. Second tests creates Proxy and stops it. But another pack of non-daemon threads are left after this proxy.
  3. After all tests pass - Junit runner calls System.exit(0) and all threads are stopped.

If we run the same logic in main() method without calling System.exit(0) JVM will not finish it execution after Proxy.stop(). I have written simple illustration for this logic here: https://gist.github.com/3524700

So I think the issue should be renamed in "DefaultHttpProxy leaves infinite alive non-daemon threads after stopping".

from littleproxy.

nasis avatar nasis commented on June 5, 2024

Well at least we agree that there is a problem.
I don't know how to change the subject of a post but if you want I can
repost on a new name.
However we will then probably loose all these comments.

On Thu, Aug 30, 2012 at 12:19 PM, Ivan Sopov [email protected]:

I have debugged you Unit Test. The problem is present here, but is not
visible. What is going on, if we run Unit tests:

  1. First test creates Proxy and stops it. But several non-daemon threads
    are left after this proxy.
  2. Second tests creates Proxy and stops it. But another pack of non-daemon
    threads are left after this proxy.
  3. After all tests pass - Junit runner calls System.exit(0) and all
    threads are stopped.

If we run the same logic in main() method without calling System.exit(0)
JVM will not finish it execution after Proxy.stop(). I have written simple
illustration for this logic here: https://gist.github.com/3524700

So I think the issue should be renamed in "DefaultHttpProxy leaves
infinite alive non-daemon threads after stopping".


Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-8153685.

from littleproxy.

adamfisk avatar adamfisk commented on June 5, 2024

Yup seeing that now guys -- thanks. Looking into it.

from littleproxy.

adamfisk avatar adamfisk commented on June 5, 2024

This should be all set now guys. I also added your straight main(...) test to the EndToEndStoppingTest to test it that way too.

from littleproxy.

adamfisk avatar adamfisk commented on June 5, 2024

Hmn...now the HttpClient test actually fails, I think because LittleProxy doesn't close the connection to the client following HTTP 1.1 rules. Reopening.

from littleproxy.

adamfisk avatar adamfisk commented on June 5, 2024

OK - this should be good to go. I keep mistakenly committing to #37, but the commit that fixes this is 93628b4

from littleproxy.

adamfisk avatar adamfisk commented on June 5, 2024

This is also deployed to the latest snapshot -- thanks for the help guys.

from littleproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.