[undertow-dev] WSS Java Client Examplt

Stuart Douglas sdouglas at redhat.com
Mon Mar 7 17:27:07 EST 2016


There is an example in the Undertow test suite here:

https://github.com/undertow-io/undertow/blob/master/websockets-jsr/src/test/java/io/undertow/websockets/jsr/test/ProgramaticLazyEndpointTest.java#L97

Basically there is no standard way to do this with the web socket API, instead you need to pass in a SSLContext under the io.undertow.websocket.SSL_CONTEXT property name. 

We also provide other ways to do this, you can implement io.undertow.websockets.jsr.WebsocketClientSslProvider (and add a META-INF/services entry for your implementation) or call io.undertow.websockets.jsr.DefaultWebSocketClientSslProvider#setSslContext() to set a thread local SSL context.

Stuart


----- Original Message -----
> From: "Steve A. Gorman" <STEPHEN.A.GORMAN at leidos.com>
> To: undertow-dev at lists.jboss.org
> Sent: Wednesday, 2 March, 2016 5:54:25 AM
> Subject: [undertow-dev] WSS Java Client Examplt
> 
> 
> 
> All,
> 
> I have a J2EE project that runs a Resource Adapter to allow some socket
> communications to a CPP app, all running in Wildfly 9. I now want to write a
> java socket listener that reads broadcast messages on a TCP/IP connection
> and forward those broadcast message to a bunch of browser sessions. My
> deployment structure is ..
> 
> 
> 
> artifact.ear
> 
> JcaAdapter.rar (tcp/ip socket reader lives in here)
> 
> BusinessLogic.war ( jcaAdapter.getConnection() and receive tcp/ip messages )
> 
> 
> 
> 
> 
> Inside my BusinessLogic.war I have created a javax
> @ServerEndpoint(“/broadcasts/”) websocket endpoint for the JS browser
> clients. Inside my JcaAdapter.rar I have put a TCP/IP socket reader which
> constantly listens for broadcast messages. When they arrive I want to have a
> Java based WSS websocket client that sends the messages to the
> @ServerEndpoint websocket. My Wildfly instance is SSL so my web socket java
> client has to be WSS.
> 
> 
> 
> I have scoured the internet and safari books looking for an example client
> for WSS written in Java but have found nothing.
> 
> 
> 
> Any help or advice is so very appreciated.
> 
> 
> 
> 
> 
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev



More information about the undertow-dev mailing list