@Override public void append(byte[] bytes) { _messageBuffer.append(bytes); String m = _messageBuffer.next(); try { if (StringUtils.isNotBlank(m)) { _messageProcess.receiveProcess(this, m); } } catch (ParseMessageException e) { logger.error("ParseMessage {} is error.", m); } }
@Override public void send(Requestable<? extends Response> request) throws IOException { synchronized (_monitor) { if (isNew()) { start(); } } if (isClose()) { logger.debug("{} Send message,but closed", _key.toString()); throw new IOException("Session already closed,not send message."); } if (isAccess(request.getMessageType())) { _messageProcess.sendProcess(this, request, _generator); if (isRequestMessage(request.getMessageType())) { _lastClientRequestTime = System.currentTimeMillis(); heartbeatTouch(); } } else { logger.debug("{} not access cti server.", _key.toString()); throw new SessionAccessException(_key); } }