-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Secure javax.websocket Client examples #4035
Fix Secure javax.websocket Client examples #4035
Conversation
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joakime this still has some problems.
I also noticed that running the test we do not get a close response and just close with close code 1006. But in the 9.4.x version of the tests we do get a 1000 response from the server. Not sure why this is happening.
@@ -92,7 +92,7 @@ public static void main(String[] args) | |||
public static WebSocketContainer getConfiguredWebSocketContainer() throws Exception | |||
{ | |||
URL jettyHttpClientConfigUrl = Thread.currentThread().getContextClassLoader() | |||
.getResource("examples/jetty-websocket-httpclient.xml"); | |||
.getResource("jetty-websocket-httpclient.xml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XmlBasedHttpClientProvider
could not find the xml file when it was in examples/
but worked when moved up a directory to resources, so I think that the ClassLoader scope stuff below doesn't work.
If you replace this entire method with just ContainerProvider.getWebSocketContainer()
it works as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for not putting that into the src/test/resources
root is because that change would make all tests would then use this jetty-websocket-httpclient.xml
I was limiting the scope of it's usage with all of that classloader nonsense to only the 2 Examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out the reason the xml does not work in src/test/resources/examples
is because in jetty-10 we lazily create the HttpClient so that the HttpClientProvider
is run during the call to client.connectToServer(echoEndpoint, clientEndpointConfig, echoUri);
in main and not in the ThreadClassLoaderScope
try block below.
maybe these examples should be junit tests so we know they are tested and working |
I'm not opposed to having tests. |
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@joakime can you review Alternatively I could just put this around the main test in the code.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Lachlan Roberts lachlan@webtide.com