WebSocketChannel.processConnectionError now defaults to NO_CLOSE
status if no protocol reasons can be found
added some debug logging
improvements to tests
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Nulling out values in WebSocketAdapter causes race conditions when
trying to access session and endpoint externally
Race condition in WebSocketChannel.Flusher.onCompleteFailure(),
processConnectionError should be called first to ensure that the
correct close reason is processed, super.onCompleteFailure() was closing
the connection causing a read failure.
race condition between the server detecting a read failure and sending
a response and the client detecting the write failure, now blocking
on the server so it is not reading and will not detect the failure
Signed-off-by: lachan-roberts <lachlan@webtide.com>
ExtensionStack.negotiate now differentiates between incorrect
extension config offered or incorrect config from negotiation
adding more BadMessageException cases
Signed-off-by: lachan-roberts <lachlan@webtide.com>
default behaviour of Negotiation no longer includes all of the
offered extensions as the negotiated extensions but it now takes
only the first extension if there are multiple of the same name,
this is now done when the negotiation is created and can be overwritten
by the negotiator
Throw exception on websocket errors so the proper status code can
be reported back to the client
fix to checking for multiple negotiated extensions of the same name
added tests for core and jetty websockets for the negotiation
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
wire up the jetty-api extensions by copying the ExtensionConfig from
the jetty-api upgrade request to the core upgrade request
make UpgradeListener interface methods default for convenience
introduce test to test the functionality of API ExtensionConfig
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
pass the cause from the AbnormalCloseStatus to closeConnection in
WSChannel
If onOpen throws we now throw a runtime exception in addition to
failing the callback, this is to fail the CompletableFuture in the
ClientUpgradeRequest.
Signed-off-by: lachan-roberts <lachlan@webtide.com>
+ Changing usages of JVM deprecated classes / methods as well
+ Cleaning up test cases and javadoc
+ Removing test methods that rely on deprecated and now removed concepts
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Jetty WebSocket API now tracks Sessions and will close them on
lifecycle stop
+ Javax WebSocket API now tracks Sessions and will close them on
lifecycle stop
+ Adding Jetty WebSocket tests for proper close / session tracking
+ Disabling tests that need triage
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
- Added test cases to test failures in and around the WebSocketProxy
and how it handles them.
- In WebSocketChannel.sendFrame() we were using a null cause for
closeConnection, we are now extracting the cause from the
AbnormalCloseStatus. This was resulting in onError not being called
when there was actually an error and an AbnormalCloseStatus.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
only do state changes inside synchronized blocks, remember what action
to do and only do this outside of the synchronized block
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
- Redesigned the proxy into a new class called WebSocketProxy containing
a Client2Proxy FrameHandler and a Server2Proxy FrameHandler
- WebSocketProxy uses synchronized blocks with an enum state instead
of the previous compare and sets
- Created a new test similar to ProxyFrameHandlerTest to test the new
WebSocketProxy
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
- Introduced an EMPTY_SESSION in the ProxyFrameHandler as a terminal
state to know whether a FailedCoreSession has been handled
- Use while(true) loops to do the compareAndSet in ProxyFrameHandler
- Improved the tests for the proxy so that it tests the frames received
at every state (ie Client Proxy and Server)
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
- HttpClientProvider is now an interface which defines a default method
newHttpClient, its static get() method get will attempt to use the
XmlHttpClientProvider to create a client, and if this fails to give a
non null client it will be created with the default newHttpClient method
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Reviewed module-info.java files.
For those that have a "requires static" added a comment about
why the dependency is optional.
Rearranged directives in alphabetical order.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
introduce channelState check in the catch in WSChannel sendFrame
to guard from multiple closes
WebSocketConnection fillAndParse will now try to read until EOF
removed state change in the isOutputOpen check in webSocketChannelState
to as we do the state change in the catch block in WSChannel
added and improved WebSocketCloseTest to test more cases
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
when the WSConnection reads EOF it now notifies the WSChannel
the channel instead of handling it locally
fixed FlusherFlusher failure issues
fixed issue with the WebSocketCloseTest expecting close reason
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Jetty and Javax ClientUpgradeRequests no longer use the combination of
the the onOpenFuture and the futureCoreSession and instead use only
the CompletableFuture future given to the FrameHandler onOpen
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Changes after review:
+ removed Adaptor from FrameHandler, so all non test usages of
FrameHandler now use async API.
+ Fixed sequencing of multiple async operation so callback is notified
after completion (created more Callback.from utilities for this)
+ fixed import order
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Gave onOpen, onError and onClose callback signatures
Illegal to ask for demand prior to onOpen success
added tests for various onOpen scenarios
Signed-off-by: Greg Wilkins <gregw@webtide.com>
WebSocketMappings are now stored as attributes in the ContextHandler
init params can be set on the filterHolder to specify what mapping
should be used
the default mapping is stored with attribute key
WebSocketMapping.DEFAULT_KEY and ensureFilter now doesn't ensure there
is an UpgradeFilter registered at "/*" but checks that there is an
UpgradeFilter using the default mapping
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Re implemented a queue and flusher above extension stack to serialize
frame handling without holding a lock when calling callbacks
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Re implemented a queue and flusher above extension stack to serialize
frame handling without holding a lock when calling callbacks
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Improve ws error handling by splitting processError into handling for
errors from the network and errors from the application.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Improve ws error handling by splitting processError into handling for
errors from the network and errors from the application.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Improve ws error handling by splitting processError into handling for
errors from the network and errors from the application.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Improve ws error handling by splitting processError into handling for
errors from the network and errors from the application.
Signed-off-by: Greg Wilkins <gregw@webtide.com>