public Channel getChannel(InetSocketAddress remoteAddress) { Set<IoSession> sessions = acceptor.getManagedSessions(getBindAddress()); for (IoSession session : sessions) { if (session.getRemoteAddress().equals(remoteAddress)) { return MinaChannel.getOrAddChannel(session, getUrl(), this); } } return null; }
public Collection<Channel> getChannels() { Set<IoSession> sessions = acceptor.getManagedSessions(getBindAddress()); Collection<Channel> channels = new HashSet<Channel>(); for (IoSession session : sessions) { if (session.isConnected()) { channels.add(MinaChannel.getOrAddChannel(session, getUrl(), this)); } } return channels; }