diff --git a/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java index a2fdba064b9..32d3f442d88 100644 --- a/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java @@ -84,7 +84,7 @@ private WsConnection(ConnectionContext ctx, .stream() .filter(p -> p instanceof WsConfig) .findFirst() - .orElse(null); + .orElseThrow(() -> new InternalError("Unable to find WebSocket config")); } /** @@ -253,9 +253,7 @@ private boolean processFrame(ClientWsFrame frame) { private ClientWsFrame readFrame() { try { - int maxFrameLength = wsConfig != null ? wsConfig.maxFrameLength() - : Integer.parseInt(MAX_FRAME_LENGTH); - return ClientWsFrame.read(ctx, dataReader, maxFrameLength); + return ClientWsFrame.read(ctx, dataReader, wsConfig.maxFrameLength()); } catch (DataReader.InsufficientDataAvailableException e) { throw new CloseConnectionException("Socket closed by the other side", e); } catch (WsCloseException e) {