[TYRUS-181] WebSocket client ignores the ProxySelector Created: 17/May/13  Updated: 24/Jun/13  Resolved: 24/Jun/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: 1.0-rc3
Fix Version/s: 1.1

Type: Bug Priority: Major
Reporter: gdavison Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified



When you are running the client, it seems like the java.net.ProxySelector is not invoked or used so the normal proxy selection mechanism is not used.

For example in this very simple self-serving case, the select method is never called.

public static void main(String[] args) throws DeploymentException, IOException {

        final ProxySelector defaultPS = ProxySelector.getDefault();
        ProxySelector.setDefault(new ProxySelector() {

            public List<Proxy> select(URI uri) {
                return defaultPS.select(uri);

            public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
                defaultPS.connectFailed(uri, sa, ioe);


        try {
            Server server = new Server("localhost", 7101, "/Project1", EchoService.class);

            // Right now we have to create a client

            ClientManager client = ClientManager.createClient();

            EchoBeanClient beanClient = new EchoBeanClient();

            Session session =
                client.connectToServer(beanClient, ClientEndpointConfig.Builder.create().build(),

            // Wait until things are closed down

            while (session.isOpen()) {



            System.out.println("Client session closed, presume we have a result " + session);

        } catch (Exception ex) {



This is the standard method of configuring a proxy in the JDK and should be observed.

Comment by Pavel Bucek [ 22/May/13 ]

Tyrus client currently does not support proxies at all. Targeted for 1.1 release.

Comment by Pavel Bucek [ 04/Jun/13 ]

Some simple proxy support is currently in the trunk:

ClientManager client = ClientManager.createClient();
client.getProperties().put(GrizzlyClientSocket.PROXY_URI, "http://my.proxy.org:80");
client.connectToServer( ... );

There is no ProxySelector support yet (I would need to introduce some kind of properties to have the possibility to disable it and so on, so it was simpler to make a single property to be able to enable proxy per client instance).

Can you please try current trunk (rev 657+) and let me know whether it works for you?


Comment by Pavel Bucek [ 24/Jun/13 ]

resolving as fixed for Tyrus 1.1; further improvements may be discussed in TYRUS-204.

Thanks Gerard for verifying and testing

Generated at Sat Mar 25 06:33:33 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.