示例#1
0
 @Override
 public void idle(Session session) {
   logger.info("heart beat request");
   try {
     session.write0(ByteBuffer.wrap(hbReq));
     session.increaseWrittenBytes(hbReq.length);
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
示例#2
0
 @Override
 public void read(Session session, Object message) {
   if (isHbRequest((Data) message)) {
     logger.info("heart beat response");
     try {
       session.write0(ByteBuffer.wrap(hbResp));
       session.increaseWrittenBytes(hbResp.length);
     } catch (IOException e) {
       e.printStackTrace();
     }
     return;
   }
   if (isHbResponse((Data) message)) {
     return;
   }
   nextFilter().read(session, message);
 }