IoHandler

Mina使用IoHandler实现业务处理

六月ゝ 毕业季﹏ 提交于 2021-01-20 02:46:09
IoHandler 是 Mina 实现其业务逻辑的顶级接口;在 IoHandler 中定义了 7 个方法,根据 I/O 事件来触发对应的方法: import java.io.IOException; public interface IoHandler { void sessionCreated(IoSession session) throws Exception; void sessionOpened(IoSession session) throws Exception; void sessionClosed(IoSession session) throws Exception; void sessionIdle(IoSession session, IdleStatus status) throws Exception; void exceptionCaught(IoSession session, Throwable cause) throws Exception; void messageReceived(IoSession session, Object message) throws Exception; void messageSent(IoSession session, Object message) throws Exception; }