作者 crossoverJie

:sparkles: Introducing new features.

@@ -72,7 +72,10 @@ public class IndexController { @@ -72,7 +72,10 @@ public class IndexController {
72 @ResponseBody 72 @ResponseBody
73 public BaseResponse<NULLBody> sendStringMsg(@RequestBody StringReqVO stringReqVO){ 73 public BaseResponse<NULLBody> sendStringMsg(@RequestBody StringReqVO stringReqVO){
74 BaseResponse<NULLBody> res = new BaseResponse(); 74 BaseResponse<NULLBody> res = new BaseResponse();
  75 +
  76 + for (int i = 0; i < 100; i++) {
75 heartbeatClient.sendStringMsg(stringReqVO.getMsg()) ; 77 heartbeatClient.sendStringMsg(stringReqVO.getMsg()) ;
  78 + }
76 79
77 // 利用 actuator 来自增 80 // 利用 actuator 来自增
78 counterService.increment(Constants.COUNTER_CLIENT_PUSH_COUNT); 81 counterService.increment(Constants.COUNTER_CLIENT_PUSH_COUNT);
@@ -95,7 +98,9 @@ public class IndexController { @@ -95,7 +98,9 @@ public class IndexController {
95 public BaseResponse<NULLBody> sendProtoBufMsg(@RequestBody GoogleProtocolVO googleProtocolVO){ 98 public BaseResponse<NULLBody> sendProtoBufMsg(@RequestBody GoogleProtocolVO googleProtocolVO){
96 BaseResponse<NULLBody> res = new BaseResponse(); 99 BaseResponse<NULLBody> res = new BaseResponse();
97 100
  101 + for (int i = 0; i < 100; i++) {
98 heartbeatClient.sendGoogleProtocolMsg(googleProtocolVO) ; 102 heartbeatClient.sendGoogleProtocolMsg(googleProtocolVO) ;
  103 + }
99 104
100 // 利用 actuator 来自增 105 // 利用 actuator 来自增
101 counterService.increment(Constants.COUNTER_CLIENT_PUSH_COUNT); 106 counterService.increment(Constants.COUNTER_CLIENT_PUSH_COUNT);
@@ -28,14 +28,15 @@ public class CustomerHandleInitializer extends ChannelInitializer<Channel> { @@ -28,14 +28,15 @@ public class CustomerHandleInitializer extends ChannelInitializer<Channel> {
28 //.addLast(new HeartbeatEncode()) 28 //.addLast(new HeartbeatEncode())
29 29
30 // google Protobuf 编解码 30 // google Protobuf 编解码
31 -  
32 //拆包解码 31 //拆包解码
33 .addLast(new ProtobufVarint32FrameDecoder()) 32 .addLast(new ProtobufVarint32FrameDecoder())
34 .addLast(new ProtobufDecoder(BaseResponseProto.ResponseProtocol.getDefaultInstance())) 33 .addLast(new ProtobufDecoder(BaseResponseProto.ResponseProtocol.getDefaultInstance()))
35 - 34 + //
36 //拆包编码 35 //拆包编码
37 .addLast(new ProtobufVarint32LengthFieldPrepender()) 36 .addLast(new ProtobufVarint32LengthFieldPrepender())
38 .addLast(new ProtobufEncoder()) 37 .addLast(new ProtobufEncoder())
  38 +
  39 +
39 .addLast(new EchoClientHandle()) 40 .addLast(new EchoClientHandle())
40 ; 41 ;
41 } 42 }