Comments (12)
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.
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.
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.
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.
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.
I have debugged your Unit Test. The problem is present there, but is not visible. What is going on, if we run Unit tests:
- First test creates Proxy and stops it. But several non-daemon threads are left after this proxy.
- Second tests creates Proxy and stops it. But another pack of non-daemon threads are left after this proxy.
- 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.
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:
- First test creates Proxy and stops it. But several non-daemon threads
are left after this proxy.- Second tests creates Proxy and stops it. But another pack of non-daemon
threads are left after this proxy.- 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/3524700So 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.
Yup seeing that now guys -- thanks. Looking into it.
from littleproxy.
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.
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.
OK - this should be good to go. I keep mistakenly committing to #37, but the commit that fixes this is 93628b4
from littleproxy.
This is also deployed to the latest snapshot -- thanks for the help guys.
from littleproxy.
Related Issues (20)
- Trying to understand org.littleshoot.proxy.ChainedProxy.filterRequest(HttpObject) HOT 2
- Caught an exception on ClientToProxyConnection
- How to intercept connect method for HTTPS request?
- 如果想更换虚拟IP在哪里配置 HOT 3
- Question: Does sending empty message really work?
- Modify POST requests, but only for certain hosts
- get real ip
- LEAK: ByteBuf.release() was not called HOT 5
- LittleProxy leaves non-daemon thread if it fails to start because of a port already in use
- http response which ssl not-used is garbled.
- Get HTTP response body
- Memory leak in ClientToProxyConnection.doReadHTTPInitial();
- How to update request body with a longer content?
- Customized TrustManager bypasses certificate verification
- Any one maintain this project?
- Avoid using plaintext Keystore password in source code HOT 2
- Eltoni HOT 1
- Can't read content of Request
- Authentication information in proxy chain HOT 2
- Check 'LittleProxy/LittleProxy' for an updated fork
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from littleproxy.