@Test public void shouldUpgradeToWebSocket() { given(mockServerWebExchange.getRequest()).willReturn(mockVertxServerHttpRequest); given(mockVertxServerHttpRequest.getNativeRequest()).willReturn(mockHttpServerRequest); given(mockHttpServerRequest.upgrade()).willReturn(mockServerWebSocket); VertxRequestUpgradeStrategy strategy = new VertxRequestUpgradeStrategy(1, 1); strategy.upgrade(mockServerWebExchange, mockWebSocketHandler, null, () -> mockHandshakeInfo); verify(mockHttpServerRequest).upgrade(); verify(mockWebSocketHandler).handle(any(VertxWebSocketSession.class)); }
@Override public Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) { LOGGER.debug("Upgrading request to web socket"); ServerHttpRequest request = exchange.getRequest(); HttpServerRequest vertxRequest = ((AbstractServerHttpRequest) request).getNativeRequest(); ServerWebSocket webSocket = vertxRequest.upgrade(); VertxWebSocketSession session = new VertxWebSocketSession(webSocket, handshakeInfoFactory.get(), bufferConverter, maxWebSocketFrameSize, maxWebSocketMessageSize); return handler.handle(session); }
VertxRequestUpgradeStrategy implements RequestUpgradeStrategy { @Override public Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) { LOGGER.debug("Upgrading request to web socket"); ServerHttpRequest request = exchange.getRequest(); HttpServerRequest vertxRequest = ((AbstractServerHttpRequest) request).getNativeRequest(); ServerWebSocket webSocket = vertxRequest.upgrade(); VertxWebSocketSession session = new VertxWebSocketSession(webSocket, handshakeInfoFactory.get(), bufferConverter, maxWebSocketFrameSize, maxWebSocketMessageSize); return handler.handle(session); } }
VertxRequestUpgradeStrategy implements RequestUpgradeStrategy { @Override public Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) { LOGGER.debug("Upgrading request to web socket"); ServerHttpRequest request = exchange.getRequest(); HttpServerRequest vertxRequest = ((AbstractServerHttpRequest) request).getNativeRequest(); ServerWebSocket webSocket = vertxRequest.upgrade(); VertxWebSocketSession session = new VertxWebSocketSession(webSocket, handshakeInfoFactory.get(), bufferConverter, maxWebSocketFrameSize, maxWebSocketMessageSize); return handler.handle(session); } VertxRequestUpgradeStrategy(int maxWebSocketFrameSize, int maxWebSocketMessageSize); }
VertxRequestUpgradeStrategy implements RequestUpgradeStrategy { @Override public Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) { LOGGER.debug("Upgrading request to web socket"); ServerHttpRequest request = exchange.getRequest(); HttpServerRequest vertxRequest = ((AbstractServerHttpRequest) request).getNativeRequest(); ServerWebSocket webSocket = vertxRequest.upgrade(); VertxWebSocketSession session = new VertxWebSocketSession(webSocket, handshakeInfoFactory.get(), bufferConverter, maxWebSocketFrameSize, maxWebSocketMessageSize); return handler.handle(session); } VertxRequestUpgradeStrategy(int maxWebSocketFrameSize, int maxWebSocketMessageSize); @Override Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler,
        @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory); }
VertxRequestUpgradeStrategy implements RequestUpgradeStrategy { @Override public Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) { LOGGER.debug("Upgrading request to web socket"); ServerHttpRequest request = exchange.getRequest(); HttpServerRequest vertxRequest = ((AbstractServerHttpRequest) request).getNativeRequest(); ServerWebSocket webSocket = vertxRequest.upgrade(); VertxWebSocketSession session = new VertxWebSocketSession(webSocket, handshakeInfoFactory.get(), bufferConverter, maxWebSocketFrameSize, maxWebSocketMessageSize); return handler.handle(session); } VertxRequestUpgradeStrategy(int maxWebSocketFrameSize, int maxWebSocketMessageSize); @Override Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler,
        @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory);  }