ASF Bugzilla – Attachment 36071 Details for
Bug 62596
WsWebSocketContainer#connectToServer throws BufferOverflowException
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Contrived example to trigger BufferOverflowException in WsWebSocketContainer#connectToServer
WebSocketTest.java (text/plain), 1.90 KB, created by
erik.mccallum
on 2018-08-03 12:43:04 UTC
(
hide
)
Description:
Contrived example to trigger BufferOverflowException in WsWebSocketContainer#connectToServer
Filename:
MIME Type:
Creator:
erik.mccallum
Created:
2018-08-03 12:43:04 UTC
Size:
1.90 KB
patch
obsolete
>import javax.websocket.ClientEndpointConfig; >import javax.websocket.ContainerProvider; >import javax.websocket.DeploymentException; >import javax.websocket.Endpoint; >import javax.websocket.EndpointConfig; >import javax.websocket.HandshakeResponse; >import javax.websocket.Session; >import javax.websocket.WebSocketContainer; >import java.io.IOException; >import java.net.URI; >import java.util.Collections; >import java.util.List; >import java.util.Map; > >/** > * @author erik > */ >public class WebSocketTest { > > private static class Configurator extends ClientEndpointConfig.Configurator { > > Configurator() { > } > > @Override > public void beforeRequest(Map<String, List<String>> headers) { > headers.put("Dummy", Collections.singletonList(String.join("", Collections.nCopies(4000, "A")))); > super.beforeRequest(headers); > } > > @Override > public void afterResponse(HandshakeResponse handshakeResponse) { > super.afterResponse(handshakeResponse); > } > } > > public static void main(String[] args) { > > Endpoint endpoint = new Endpoint() { > @Override > public void onOpen(Session session, EndpointConfig endpointConfig) { > } > }; > > ClientEndpointConfig endpointConfig = ClientEndpointConfig.Builder.create() > .configurator(new Configurator()) > .build(); > > WebSocketContainer container = ContainerProvider.getWebSocketContainer(); > try { > Session backendSession = container.connectToServer(endpoint, endpointConfig, > URI.create("ws://demos.kaazing.com/echo?.kl=Y")); > > backendSession.close(); > > } catch (DeploymentException e) { > e.printStackTrace(); > } catch (IOException e) { > e.printStackTrace(); > } > > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 62596
: 36071