From 484907432e848f0e935b5e48f1ea3a5fb6b914b6 Mon Sep 17 00:00:00 2001 From: mrliudeveloper Date: Fri, 24 Dec 2021 16:06:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?Netty=E6=9C=8D=E5=8A=A1=E7=9B=91=E5=90=AC?= =?UTF-8?q?=E5=A4=9A=E4=B8=AArabbitMQ=E6=B6=88=E6=81=AF=E9=98=9F=E5=88=97?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simu/handler/event/ConnectionHandler.java | 1 - .../simu/simulation/SimulationService.java | 21 +++++++++++++ .../simu/simulation/SimulationSink.java | 21 +++++++++++++ src/main/resources/application.yml | 30 +++++++++++++++---- 4 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/github/hollykunge/simu/simulation/SimulationService.java create mode 100644 src/main/java/com/github/hollykunge/simu/simulation/SimulationSink.java diff --git a/src/main/java/com/github/hollykunge/simu/handler/event/ConnectionHandler.java b/src/main/java/com/github/hollykunge/simu/handler/event/ConnectionHandler.java index 13288c0..33429a1 100644 --- a/src/main/java/com/github/hollykunge/simu/handler/event/ConnectionHandler.java +++ b/src/main/java/com/github/hollykunge/simu/handler/event/ConnectionHandler.java @@ -6,7 +6,6 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.handler.codec.http.DefaultHttpRequest; import io.netty.handler.codec.http.FullHttpRequest; -import io.netty.handler.codec.http.HttpRequest; import io.netty.util.AttributeKey; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/github/hollykunge/simu/simulation/SimulationService.java b/src/main/java/com/github/hollykunge/simu/simulation/SimulationService.java new file mode 100644 index 0000000..a5f9823 --- /dev/null +++ b/src/main/java/com/github/hollykunge/simu/simulation/SimulationService.java @@ -0,0 +1,21 @@ +package com.github.hollykunge.simu.simulation; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.cloud.stream.annotation.EnableBinding; +import org.springframework.cloud.stream.annotation.StreamListener; +import org.springframework.messaging.Message; +import org.springframework.stereotype.Component; + +/** + * @author Mr.Liu + */ +@Slf4j +@Component +@EnableBinding(SimulationSink.class) +public class SimulationService { + + @StreamListener(SimulationSink.SIMULATION_INPUT) + public void input(Message message){ + log.info(SimulationSink.SIMULATION_INPUT+":"+message.getPayload()); + } +} diff --git a/src/main/java/com/github/hollykunge/simu/simulation/SimulationSink.java b/src/main/java/com/github/hollykunge/simu/simulation/SimulationSink.java new file mode 100644 index 0000000..6a44ac5 --- /dev/null +++ b/src/main/java/com/github/hollykunge/simu/simulation/SimulationSink.java @@ -0,0 +1,21 @@ +package com.github.hollykunge.simu.simulation; + +import org.springframework.cloud.stream.annotation.Input; +import org.springframework.messaging.SubscribableChannel; + +/** + * @author Mr.Liu + */ +public interface SimulationSink { + + String SIMULATION_INPUT="input2"; + + + + /** + * simulation监听 + * @return SubscribableChannel + */ + @Input(SimulationSink.SIMULATION_INPUT) + SubscribableChannel simulationInput(); +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ed1b292..c45a496 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,24 +2,42 @@ server: port: 6789 spring: rabbitmq: - host: 10.11.24.136 - port: 5672 + virtual-host: / +# virtual-host: /simuMsg + host: 10.11.24.134 +# host: 10.11.24.136 username: hollykunge password: 123456 - virtual-host: /simuMsg + port: 5672 cloud: stream: binders: defaultRabbitmq: rabbitmq: - virtual-host: /simuMsg - host: 10.11.24.136 + virtual-host: / + # virtual-host: /simuMsg + host: 10.11.24.134 + # host: 10.11.24.136 port: 5672 username: hollykunge password: 123456 bindings: + # model && mms服务 input: destination: simuMsg content-type: application/json + # simulation 服务 + input2: + destination: exchange_simulation + content-type: application/json + # 如果不分组的话,队列将会是匿名的 binder: rabbit - + group: queue_simulation + rabbit: + bindings: + input2: + group: queue_simulation + consumer: + exchangeType: direct + queueNameGroupOnly: true + bindingRoutingKey: routekey_simulation -- Gitee From 21e7720035c62ce660bbbeae67e1977698de6d44 Mon Sep 17 00:00:00 2001 From: "Mr.Liu" <1343926437@qq.com> Date: Sat, 25 Dec 2021 12:11:00 +0800 Subject: [PATCH 2/4] Log info Optimization. --- .../hollykunge/simu/config/Constant.java | 4 +++ .../service/impl/CustomerServiceImpl.java | 36 +++++++++++-------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/github/hollykunge/simu/config/Constant.java b/src/main/java/com/github/hollykunge/simu/config/Constant.java index c883442..b6b1d81 100644 --- a/src/main/java/com/github/hollykunge/simu/config/Constant.java +++ b/src/main/java/com/github/hollykunge/simu/config/Constant.java @@ -21,4 +21,8 @@ public class Constant { * 用户信息主键 */ public static final String USER_KEY = "userId"; + /** + * 打印处理 + */ + public static final String PRINT_DESCRIBE = "Does not conform to the existing communication protocol, only to print processing!\n"; } diff --git a/src/main/java/com/github/hollykunge/simu/service/impl/CustomerServiceImpl.java b/src/main/java/com/github/hollykunge/simu/service/impl/CustomerServiceImpl.java index c056c6c..384df07 100644 --- a/src/main/java/com/github/hollykunge/simu/service/impl/CustomerServiceImpl.java +++ b/src/main/java/com/github/hollykunge/simu/service/impl/CustomerServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; import static com.github.hollykunge.simu.config.Constant.END_STATUS; +import static com.github.hollykunge.simu.config.Constant.PRINT_DESCRIBE; import static com.github.hollykunge.simu.websocket.NettyConfig.getUserChannel; /** @@ -36,22 +37,27 @@ public class CustomerServiceImpl implements CustomerService { /* * 数据解析 */ - final String payload = message.getPayload(); - final JSONObject parse = (JSONObject) JSONObject.parse(payload); - final String userId = (String) parse.get("userId"); - final String msg = (String) parse.get("msg"); - /* - *数据推送 - */ - final Channel userChannel = getUserChannel(userId); - if (null != userChannel) { - userChannel.writeAndFlush(new TextWebSocketFrame(msg)); - if (msg.equals(END_STATUS)) { - log.info("Message sending End... " + msg); - connUtils.removeConnection(userId); + try { + final String payload = message.getPayload(); + final JSONObject parse = (JSONObject) JSONObject.parse(payload); + final String userId = (String) parse.get("userId"); + final String msg = (String) parse.get("msg"); + /* + *数据推送 + */ + final Channel userChannel = getUserChannel(userId); + if (null != userChannel) { + userChannel.writeAndFlush(new TextWebSocketFrame(msg)); + if (msg.equals(END_STATUS)) { + log.info("Message sending End... " + msg); + connUtils.removeConnection(userId); + } + } else { + log.error(userId + "channel not exist!"); } - } else { - log.error(userId + "channel not exist!"); + } catch (Exception e) { + log.warn(PRINT_DESCRIBE + "content is as follows: " + message.getPayload()); } + } } -- Gitee From 61010bb7bb84cb9e84876a0f212907468e7fb8da Mon Sep 17 00:00:00 2001 From: mrliudeveloper Date: Mon, 27 Dec 2021 16:01:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0Handler=E5=92=8C=E5=AE=8C=E6=88=90WebSocket?= =?UTF-8?q?=E6=8F=A1=E6=89=8B=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 ++ .../hollykunge/simu/config/Constant.java | 4 ++ .../simu/handler/event/ConnectionHandler.java | 45 ++++++++++++----- .../simu/handler/event/HeartBeatHandler.java | 8 +-- .../simu/handler/event/WebSocketHandler.java | 27 +++++----- .../simu/handler/msg/MsgTextHandler.java | 9 ++-- .../simu/simulation/SimulationService.java | 16 +++++- .../hollykunge/simu/utils/ConnUtils.java | 24 +++++++++ .../simu/websocket/NettyServer.java | 4 +- src/main/resources/static/index_get.html | 49 +++++++++++++++++++ 10 files changed, 153 insertions(+), 38 deletions(-) create mode 100644 src/main/resources/static/index_get.html diff --git a/README.md b/README.md index 9e3c806..466b369 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ WebSocket #### 自定义简单的协议 1.建立链接:{"code":"0","con":"{'userId':'V7SnFNmm'}"} + 2.心跳发送:{"code":"1"} + 3.断开链接:{"end":"FMIstop"} #### 2021.12.13 更新 @@ -25,3 +27,6 @@ WebSocket #### 2021.12.20 更新 更新内容: 为SocketChannel保存属性userId信息 + +#### 2021.12.27 更新 +更新内容: 完成动态添加Handler和完成WebSocket握手功能 diff --git a/src/main/java/com/github/hollykunge/simu/config/Constant.java b/src/main/java/com/github/hollykunge/simu/config/Constant.java index b6b1d81..fd6c655 100644 --- a/src/main/java/com/github/hollykunge/simu/config/Constant.java +++ b/src/main/java/com/github/hollykunge/simu/config/Constant.java @@ -25,4 +25,8 @@ public class Constant { * 打印处理 */ public static final String PRINT_DESCRIBE = "Does not conform to the existing communication protocol, only to print processing!\n"; + /** + * simulation心跳内容 + */ + public static final String HEART_BEAT_STRING = "心跳内容"; } diff --git a/src/main/java/com/github/hollykunge/simu/handler/event/ConnectionHandler.java b/src/main/java/com/github/hollykunge/simu/handler/event/ConnectionHandler.java index 33429a1..e973d52 100644 --- a/src/main/java/com/github/hollykunge/simu/handler/event/ConnectionHandler.java +++ b/src/main/java/com/github/hollykunge/simu/handler/event/ConnectionHandler.java @@ -4,8 +4,10 @@ import com.github.hollykunge.simu.utils.ParamUtils; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.handler.codec.http.DefaultHttpRequest; import io.netty.handler.codec.http.FullHttpRequest; +import io.netty.handler.codec.http.HttpRequest; +import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler; +import io.netty.util.Attribute; import io.netty.util.AttributeKey; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -13,6 +15,7 @@ import org.springframework.stereotype.Component; import java.util.HashMap; import static com.github.hollykunge.simu.config.Constant.USER_KEY; +import static com.github.hollykunge.simu.utils.ConnUtils.handShaker; import static com.github.hollykunge.simu.websocket.NettyConfig.addUser; import static com.github.hollykunge.simu.websocket.NettyConfig.addUserChannel; @@ -30,23 +33,41 @@ public class ConnectionHandler extends ChannelInboundHandlerAdapter { if (null == msg) { return; } - if (msg instanceof DefaultHttpRequest) { - final DefaultHttpRequest request = (DefaultHttpRequest) msg; - getUserChannelKey(ctx, request.uri()); - } else if (msg instanceof FullHttpRequest) { + if (msg instanceof FullHttpRequest) { final FullHttpRequest request = (FullHttpRequest) msg; - getUserChannelKey(ctx, request.uri()); + getUserChannelKey(ctx, request.uri(), request); } super.channelRead(ctx, msg); } - private void getUserChannelKey(ChannelHandlerContext ctx, String uri) { + /** + * 带请求参数的http请求获取管道主键 + * + * @param ctx 管道上下文 + * @param uri 请求地址 + * @param request 请求对象 + */ + private void getUserChannelKey(ChannelHandlerContext ctx, String uri, HttpRequest request) { final HashMap urlParams = ParamUtils.getUrlParams(uri); - final Channel channel = ctx.channel(); - channel.attr(AttributeKey.valueOf(USER_KEY)).setIfAbsent(urlParams.get(USER_KEY)); - addUser(urlParams.get(USER_KEY), channel); - addUserChannel(urlParams.get(USER_KEY), channel); - System.out.println(urlParams); + if (urlParams.get(USER_KEY) != null) { + //请求信息与Channel绑定 + final Channel channel = ctx.channel(); + final Attribute attr = channel.attr(AttributeKey.valueOf(USER_KEY)); + attr.setIfAbsent(urlParams.get(USER_KEY)); + addUser(urlParams.get(USER_KEY), channel); + addUserChannel(urlParams.get(USER_KEY), channel); + System.out.println(urlParams); + //完成WebSocket握手 + handShaker(ctx, uri, request); + } else { + //解析不到url中的参数则证明是Model or MMS,使用默认的WebSocketHandler + ctx.pipeline().addAfter( + "ConnectionHandler", + "WebSocketServerProtocolHandler", + new WebSocketServerProtocolHandler("/")); + } } + + } diff --git a/src/main/java/com/github/hollykunge/simu/handler/event/HeartBeatHandler.java b/src/main/java/com/github/hollykunge/simu/handler/event/HeartBeatHandler.java index c535e6d..4789dfc 100644 --- a/src/main/java/com/github/hollykunge/simu/handler/event/HeartBeatHandler.java +++ b/src/main/java/com/github/hollykunge/simu/handler/event/HeartBeatHandler.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; public class HeartBeatHandler extends ChannelInboundHandlerAdapter { /** - * 连接检测 + * 连接心跳检测 * * @param ctx 上下文对象 * @param evt 事件实体 @@ -31,11 +31,11 @@ public class HeartBeatHandler extends ChannelInboundHandlerAdapter { if (evt instanceof IdleStateEvent) { final IdleState state = ((IdleStateEvent) evt).state(); if (state == IdleState.ALL_IDLE) { - log.info("读写空闲..."); + log.info("Read and write free..."); } else if (IdleState.READER_IDLE == state) { - log.info("读空闲..."); + log.info("Read free..."); } else if (IdleState.WRITER_IDLE == state) { - log.info("写空闲..."); + log.info("Write free..."); } } super.userEventTriggered(ctx, evt); diff --git a/src/main/java/com/github/hollykunge/simu/handler/event/WebSocketHandler.java b/src/main/java/com/github/hollykunge/simu/handler/event/WebSocketHandler.java index 41f3360..c0f5b96 100644 --- a/src/main/java/com/github/hollykunge/simu/handler/event/WebSocketHandler.java +++ b/src/main/java/com/github/hollykunge/simu/handler/event/WebSocketHandler.java @@ -5,7 +5,6 @@ import com.github.hollykunge.simu.handler.msg.IMsgHandlerFactory; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; -import io.netty.handler.codec.http.websocketx.WebSocketFrame; import io.netty.util.AttributeKey; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -43,26 +42,20 @@ public class WebSocketHandler extends SimpleChannelInboundHandler { } /** - * 消息对象向下转型 + * 没有任何WebSocket连接到Netty * - * @param msg msg - * @param - * @return WebSocketFrame + * @param ctx 连接上下文 */ - @SuppressWarnings("all") - private static T cast(Object msg) { - if (null == msg) { - return null; - } else { - return (T) msg; - } - } - @Override public void channelUnregistered(ChannelHandlerContext ctx) { log.info("Netty Server leisure ..."); } + /** + * 连接被客户端关闭 + * + * @param ctx 连接上下文 + */ @Override public void channelInactive(ChannelHandlerContext ctx) { try { @@ -75,6 +68,12 @@ public class WebSocketHandler extends SimpleChannelInboundHandler { } } + /** + * 发生异常及时释放连接 + * + * @param ctx 通道上下文 + * @param cause 异常内容 + */ @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { try { diff --git a/src/main/java/com/github/hollykunge/simu/handler/msg/MsgTextHandler.java b/src/main/java/com/github/hollykunge/simu/handler/msg/MsgTextHandler.java index 70df632..4d6fd28 100644 --- a/src/main/java/com/github/hollykunge/simu/handler/msg/MsgTextHandler.java +++ b/src/main/java/com/github/hollykunge/simu/handler/msg/MsgTextHandler.java @@ -8,8 +8,7 @@ import io.netty.util.Attribute; import io.netty.util.AttributeKey; import lombok.extern.slf4j.Slf4j; -import static com.github.hollykunge.simu.config.Constant.CREATE_CONN; -import static com.github.hollykunge.simu.config.Constant.HEART_BEAT; +import static com.github.hollykunge.simu.config.Constant.*; import static com.github.hollykunge.simu.websocket.NettyConfig.*; import static com.github.hollykunge.simu.websocket.NettyConfig.getUserChannelSize; @@ -29,6 +28,10 @@ public class MsgTextHandler implements IMsgHandler { TextWebSocketFrame textFrame = (TextWebSocketFrame) msg; String message = textFrame.text(); + if (HEART_BEAT_STRING.equals(message)) { + log.info(HEART_BEAT_STRING +" from : Simulation"); + return; + } JSONObject parse = (JSONObject) JSONObject.parse(message); log.info("receiveMsg:" + parse); String con = parse.getString("con"); @@ -45,7 +48,7 @@ public class MsgTextHandler implements IMsgHandler { } else if (HEART_BEAT.equals(code)) { //自定义心跳,将客户端心跳直接返回 //ctx.writeAndFlush(HEART_BEAT_MSG); 客户端没有正确做出处理暂时注释 - log.info("Received a heartbeat"); + log.info(HEART_BEAT_STRING +"from : Model or MMS"); log.warn("channelGroup:" + getChannelSize() + ";" + "channelMap:" + getUserChannelSize()); } } diff --git a/src/main/java/com/github/hollykunge/simu/simulation/SimulationService.java b/src/main/java/com/github/hollykunge/simu/simulation/SimulationService.java index a5f9823..7bdbcf8 100644 --- a/src/main/java/com/github/hollykunge/simu/simulation/SimulationService.java +++ b/src/main/java/com/github/hollykunge/simu/simulation/SimulationService.java @@ -1,11 +1,14 @@ package com.github.hollykunge.simu.simulation; +import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.springframework.cloud.stream.annotation.EnableBinding; import org.springframework.cloud.stream.annotation.StreamListener; import org.springframework.messaging.Message; import org.springframework.stereotype.Component; +import static com.github.hollykunge.simu.config.Constant.PRINT_DESCRIBE; + /** * @author Mr.Liu */ @@ -15,7 +18,16 @@ import org.springframework.stereotype.Component; public class SimulationService { @StreamListener(SimulationSink.SIMULATION_INPUT) - public void input(Message message){ - log.info(SimulationSink.SIMULATION_INPUT+":"+message.getPayload()); + public void input(Message message) { + log.info(SimulationSink.SIMULATION_INPUT + ":" + message.getPayload()); + final String payload = message.getPayload(); + try { + final JSONObject parse = (JSONObject) JSONObject.parse(payload); + log.warn(parse.getString("code")); + log.warn(parse.getString("address")); + log.warn(parse.getString("data")); + } catch (Exception e) { + log.error(PRINT_DESCRIBE + "\n" + payload); + } } } diff --git a/src/main/java/com/github/hollykunge/simu/utils/ConnUtils.java b/src/main/java/com/github/hollykunge/simu/utils/ConnUtils.java index 045490c..de2a2f4 100644 --- a/src/main/java/com/github/hollykunge/simu/utils/ConnUtils.java +++ b/src/main/java/com/github/hollykunge/simu/utils/ConnUtils.java @@ -1,6 +1,11 @@ package com.github.hollykunge.simu.utils; import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http.HttpHeaders; +import io.netty.handler.codec.http.HttpRequest; +import io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker; +import io.netty.handler.codec.http.websocketx.WebSocketServerHandshakerFactory; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -31,4 +36,23 @@ public class ConnUtils { log.error(e.getMessage()); } } + + /** + * 处理 http 升级为 WebSocket,完成握手 + * + * @param ctx 管道上下文 + * @param uri 请求地址 + * @param request 请求对象 + */ + public static void handShaker(ChannelHandlerContext ctx, String uri, HttpRequest request) { + WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory( + "ws://" + request.headers().get(HttpHeaders.Names.HOST) + uri, null, false); + final WebSocketServerHandshaker handShaker = wsFactory.newHandshaker(request); + + if (handShaker == null) { + WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel()); + } else { + handShaker.handshake(ctx.channel(), request); + } + } } diff --git a/src/main/java/com/github/hollykunge/simu/websocket/NettyServer.java b/src/main/java/com/github/hollykunge/simu/websocket/NettyServer.java index a82d796..e61e83f 100644 --- a/src/main/java/com/github/hollykunge/simu/websocket/NettyServer.java +++ b/src/main/java/com/github/hollykunge/simu/websocket/NettyServer.java @@ -10,7 +10,6 @@ import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.HttpServerCodec; -import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; import io.netty.handler.stream.ChunkedWriteHandler; @@ -69,8 +68,7 @@ public class NettyServer { pipeline.addLast("IdleState", new IdleStateHandler(20, 30, 50, TimeUnit.SECONDS)); pipeline.addLast(new HeartBeatHandler()); pipeline.addLast("aggregator", new HttpObjectAggregator(1024 * 1024 * 1024)); - pipeline.addLast(new WebSocketServerProtocolHandler("/")); - pipeline.addLast(new ConnectionHandler()); + pipeline.addLast("ConnectionHandler", new ConnectionHandler()); pipeline.addLast(webSocketHandler); } }); diff --git a/src/main/resources/static/index_get.html b/src/main/resources/static/index_get.html new file mode 100644 index 0000000..267b208 --- /dev/null +++ b/src/main/resources/static/index_get.html @@ -0,0 +1,49 @@ + + + + + Title + + + +
+ + +
+ + -- Gitee From d1520faeb83ea648f2849b1ae25fbf2c795bf5bb Mon Sep 17 00:00:00 2001 From: mrliudeveloper Date: Mon, 27 Dec 2021 16:02:20 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=BC=BA=E8=BF=AB=E7=97=87=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/github/hollykunge/simu/utils/ConnUtils.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/github/hollykunge/simu/utils/ConnUtils.java b/src/main/java/com/github/hollykunge/simu/utils/ConnUtils.java index de2a2f4..8bd255e 100644 --- a/src/main/java/com/github/hollykunge/simu/utils/ConnUtils.java +++ b/src/main/java/com/github/hollykunge/simu/utils/ConnUtils.java @@ -44,6 +44,7 @@ public class ConnUtils { * @param uri 请求地址 * @param request 请求对象 */ + @SuppressWarnings("all") public static void handShaker(ChannelHandlerContext ctx, String uri, HttpRequest request) { WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory( "ws://" + request.headers().get(HttpHeaders.Names.HOST) + uri, null, false); -- Gitee