Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6685395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:03:10+00:00 2026-05-26T05:03:10+00:00

I have to call a WS that requires custom client authentication. This authentication is

  • 0

I have to call a WS that requires custom client authentication. This authentication is done by a program running on the client and listening on http://127.0.0.1:80.
So I add a ProxySelector when starting up like this :

final ProxySelector ps = new ProxySelector() {
    @Override
    public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
        ioe.printStackTrace();
    }

    @Override
    public List<Proxy> select(URI uri) {
        final List<Proxy> proxy = new ArrayList<Proxy>();
        final SocketAddress adr = new InetSocketAddress("127.0.0.1", 80);
        final Proxy p = new Proxy(Proxy.Type.HTTP, adr);
        proxy.add(p);
        return proxy;
};
ProxySelector.setDefault(ps);

This use to work fine, but after some refactoring (not related to WS calls), instead of having http://my.server.com as URI input, I have socket://my.server.com and it fails with a “Unknown proxy type : HTTP”, what seems quite normal with SOCKET scheme…

The difference between my old application and the new one is the behavior during HttpUrlConnection.plainConnect() was not the same. Indeed, the working version calls my ProxySelector with the right URI (line 922 of http://www.docjar.com/html/api/sun/net/www/protocol/http/HttpURLConnection.java.html),
whereas the new version jump to line 959 and start creating a new underlying connection, which ends up with a socket:// scheme.

So the difference lies in following lines :

ProxySelector sel =
    java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction<ProxySelector>() {
            public ProxySelector run() {
                return ProxySelector.getDefault();
            }
        });

This used to return my ProxySelector as “sel” but now returns null.

Can someone explain me what exactly means these lines, and why the result is not the same than in my old app ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:03:10+00:00Added an answer on May 26, 2026 at 5:03 am

    Eventually, I figured this out !

    The jaxws-maven-plugin used to generate WS client was in version 1.10 in the working application, and changed to 1.12 in the new one, what introduced the changes in HttpUrlConnection as explained above.

    Still don’t know what happened, and which dependent library has changed between 1.10 and 1.12 but there is a quite BIG difference in the way of creating HttpConnections 🙂

    Thanks anyway for those who read my weird question… ^^

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service that I call via ajax that requires the user
I have a C program which has a function call that is defined in
I'm updating a program for my company that requires the user to have SQL
I have a regex call that I need help with. I haven't posted my
I am begging to use jquery. I have the following call that works in
I have a Guid.NewGuid() call that is creating an Empty Guid. What would cause
I have a reference to call that may or may not be there. When
I have an $.ajax call that includes both a success and error condition: $('input[name=StateName]').live('change',
I have a synchronous web service call that returns a message. I need to
I have function getCartItems in cart.js and I want to call that function in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.