[BUG] Cannot use windows proxy in azure-core-http-netty
Describe the bug When using azure-core-http-netty in windows 10, it can't use system proxy when using MAVEN_OPTS="-Djava.net.useSystemProxies=true"
Exception or Stack Trace Add the exception log and stack trace if available
To Reproduce Steps to reproduce the behavior:
- Setup a windows proxy (charles, wireshark or so on)
- Request a sample url in a maven project
- Run it with MAVEN_OPTS="-Djava.net.useSystemProxies=true"
Code Snippet
HttpRequest request = new HttpRequest(HttpMethod.GET, "http://date.jsontest.com/");
// HttpResponse response = new NettyAsyncHttpClientBuilder().build().send(request).block(); // azure-core-http-netty
HttpResponse response = new OkHttpAsyncHttpClientBuilder().build().send(request).block(); // azure-core-http-okhttp
System.out.println(response.getStatusCode());
Flux<ByteBuffer> body = response.getBody();
body.doOnNext(byteBuffer -> {
System.out.println(byteBuffer.limit());
for (int i = byteBuffer.position(); i < byteBuffer.limit(); ++i) {
System.out.print((char)byteBuffer.get(i));
}
}).blockLast();
The above code could be used for test the request. When using the 2nd line, the request could not go through the proxy. When using the 3rd line, the request can go through the proxy as expected (but it is blocking and not end after the request finished, this may be another bug)
Expected behavior Two clients all do request through system proxy.
Screenshots
I run two times with different client, but only the okhttp client is recorded by proxy.

Setup (please complete the following information):
- OS: Windows 10 1909
- IDE : IntelliJ
- Version of the Library used: azure-core-http-netty 1.2.0, azure-core-http-okhttp 1.1.0
Additional context Add any other context about the problem here.
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [x] Bug Description Added
- [x] Repro Steps Added
- [x] Setup information Added
@alzimmermsft is working on proxy support at present, so he may want to weigh in here.
HI @ChenTanyi,
Currently, the Java SDKs don't take advantage of the Java proxy variables, this is outlined in issue #5832. I'm actively working on this and am hopeful to have a PR opened for it later this week, I will notify you once it is open for review.
Resolved in PR #7593
Hi @alzimmermsft,
I have tested azure-core-http-netty built by the latest master.
The code snippets are the same as above.
But no matter I use:
export MAVEN_OPTS="-Djava.net.useSystemProxies=true"export MAVEN_OPTS="-Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8888 -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8888"
The http request still cannot go through my proxy where the okhttp can go through.
Can you give me an example that makes netty use the proxy?
We ran into this same problem. Had to use okhttp. @alzimmermsft can you please advise?
@oboxer mind opening a new issue for your case given that this one is closed