当前位置: 首页 > news >正文

做兼职工作上哪个网站招聘修改wordpress默认主题标题

做兼职工作上哪个网站招聘,修改wordpress默认主题标题,桂林网络公司官网维护,汕头网站建设方案书1.Netty服务端 服务端代码参考【基于Netty实现安全认证的WebSocket#xff08;wss#xff09;服务端-CSDN博客】 2.Netty客户端 客户端代码参考【基于Netty实现WebSocket客户端-CSDN博客】中两种都可以#xff1b;这里用的是第一种。 新增SslHandler的代码#xff1a; …1.Netty服务端 服务端代码参考【基于Netty实现安全认证的WebSocketwss服务端-CSDN博客】 2.Netty客户端 客户端代码参考【基于Netty实现WebSocket客户端-CSDN博客】中两种都可以这里用的是第一种。 新增SslHandler的代码 SslContext sslCtx SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build(); ... pipeline.addLast(sslCtx.newHandler(sc.alloc(), webSocketURL.getHost(), webSocketURL.getPort())); 服务端地址的协议头调整为wss final URI webSocketURL new URI(wss://127.0.0.1:7070/helloWs); 完整的客户端代码如下 import io.netty.bootstrap.Bootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.ChannelPipeline; import io.netty.channel.EventLoopGroup; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.codec.http.DefaultHttpHeaders; import io.netty.handler.codec.http.HttpClientCodec; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory; import io.netty.handler.codec.http.websocketx.WebSocketClientProtocolHandler; import io.netty.handler.codec.http.websocketx.WebSocketVersion; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContextBuilder; import io.netty.handler.ssl.util.InsecureTrustManagerFactory; import io.netty.handler.stream.ChunkedWriteHandler; import lombok.extern.slf4j.Slf4j;import java.net.URI; import java.util.concurrent.CountDownLatch;/*** https://blog.csdn.net/a1053765496/article/details/130701218* 基于Netty快速实现WebSocket客户端不手动处理握手*/ Slf4j public class SimpleWssClient {final CountDownLatch latch new CountDownLatch(1);public static void main(String[] args) throws Exception {SimpleWssClient client new SimpleWssClient();client.test();}public void test() throws Exception {Channel dest dest();latch.await();dest.writeAndFlush(new TextWebSocketFrame(CountDownLatch完成后发送的消息));}public Channel dest() throws Exception {final URI webSocketURL new URI(wss://127.0.0.1:7070/helloWs);EventLoopGroup group new NioEventLoopGroup();SslContext sslCtx SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();Bootstrap boot new Bootstrap();boot.option(ChannelOption.SO_KEEPALIVE, true).option(ChannelOption.TCP_NODELAY, true).group(group).handler(new LoggingHandler(LogLevel.INFO)).channel(NioSocketChannel.class).handler(new ChannelInitializerSocketChannel() {Overrideprotected void initChannel(SocketChannel sc) throws Exception {ChannelPipeline pipeline sc.pipeline();pipeline.addLast(sslCtx.newHandler(sc.alloc(), webSocketURL.getHost(), webSocketURL.getPort()));pipeline.addLast(new HttpClientCodec());pipeline.addLast(new ChunkedWriteHandler());pipeline.addLast(new HttpObjectAggregator(64 * 1024));pipeline.addLast(new WebSocketClientProtocolHandler(WebSocketClientHandshakerFactory.newHandshaker(webSocketURL, WebSocketVersion.V13, null, false, new DefaultHttpHeaders())));pipeline.addLast(new SimpleChannelInboundHandlerTextWebSocketFrame() {Overrideprotected void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame msg)throws Exception {System.err.println( 客户端收到消息 msg.text());}Overridepublic void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {if (WebSocketClientProtocolHandler.ClientHandshakeStateEvent.HANDSHAKE_COMPLETE.equals(evt)) {log.info(ctx.channel().id().asShortText() 握手完成);latch.countDown();send(ctx.channel());}super.userEventTriggered(ctx, evt);}});}});ChannelFuture cf boot.connect(webSocketURL.getHost(), webSocketURL.getPort()).sync();return cf.channel();}public static void send(Channel channel) {final String textMsg 握手完成后直接发送的消息;if (channel ! null channel.isActive()) {TextWebSocketFrame frame new TextWebSocketFrame(textMsg);channel.writeAndFlush(frame).addListener((ChannelFutureListener) channelFuture - {if (channelFuture.isDone() channelFuture.isSuccess()) {log.info( 发送成功.);} else {channelFuture.channel().close();log.info( 发送失败. cause channelFuture.cause());channelFuture.cause().printStackTrace();}});} else {log.error(消息发送失败 textMsg textMsg);}}} 参考利用netty开发webScoketClient支持wss协议客户端、服务端心跳实现_websocketclient-CSDN博客
http://www.w-s-a.com/news/531135/

相关文章:

  • 网站开发学哪种语言网站编辑器失效
  • WordPress插件提示信息江阴网站优化
  • 网站开发用的软件如何做网站内容管理
  • 扬州网站建设公司网站推广是什么岗位
  • 双线网站管理咨询公司是做什么
  • asia域名的网站贵州光利达建设工程有限公司局网站
  • 梅州南站济南做网络安全的公司
  • 网站源代码 phpseo营销推广费用
  • 南京专业制作网站深圳整装装修公司排名
  • 网站制作在哪里比较好网页设计的要点有哪些
  • 自己做网站原始代码高端品牌服装
  • 九度企业网站推广软件龙泉市建设局网站
  • 做个企业网网站怎么做专业3合1网站建设公司
  • 龙岩网站建设teams熊掌号公司网站的实例
  • 电商模板网站免费省级精品课程网站建设
  • 网站建设的规划书桂林生活最新网
  • 广东省建设工程执业中心网站wordpress的分类目录和标签
  • 甘肃省两学一做专题网站广东外发加工网
  • 用python导入wordpress公司网络优化方案
  • 效益成本原则网站建设wordpress 上传rar
  • 大连网站制作 连城传媒渠道网络公司官网
  • 电影天堂网站用什么程序做的wordpress 添加链接地址
  • 购买空间网站哪个好重庆英文网站建设
  • 建设网站需要注意什么问题设计网页通常使用什么语言
  • 彩票网站建设要多少钱西安英文网站建设
  • 静态班级网站印象云笔记 wordpress
  • 网站表单及商品列表详情模板永川网站制作联系电话
  • 网站建设与维护难不难网络服务机构的网站
  • 用三权重的网站做友链有好处没企业年金怎么查询
  • 工行网站跟建设网站区别wordpress加入地图