@Override protected TcpAddress writeData(SelectionKey sk, TcpAddress incomingAddress) { SocketEntry entry = (SocketEntry) sk.attachment(); try { SocketChannel sc = (SocketChannel) sk.channel(); incomingAddress = new TcpAddress(sc.socket().getInetAddress(), sc.socket().getPort()); if ((entry != null) && (!entry.hasMessage())) { synchronized (pending) { pending.remove(entry); entry.removeRegistration(selector, SelectionKey.OP_WRITE); } } if (entry != null) { writeMessage(entry, sc); } } catch (IOException iox) { logger.warn(iox); TransportStateEvent e = new TransportStateEvent(TLSTM.this, incomingAddress, TransportStateEvent. STATE_DISCONNECTED_REMOTELY, iox); fireConnectionStateChanged(e); // make sure channel is closed properly: closeChannel(sk.channel()); } return incomingAddress; }
STATE_DISCONNECTED_REMOTELY, iox); fireConnectionStateChanged(e);
STATE_CONNECTED, null); fireConnectionStateChanged(e);
STATE_CONNECTED, null); fireConnectionStateChanged(e); if (e.isCancelled()) { logger.warn("Incoming connection cancelled"); STATE_DISCONNECTED_REMOTELY, iox); fireConnectionStateChanged(e);
STATE_CONNECTED, null); fireConnectionStateChanged(e); if (e.isCancelled()) { logger.warn("Incoming connection cancelled"); STATE_DISCONNECTED_REMOTELY, iox); fireConnectionStateChanged(e);
TransportStateEvent.STATE_CLOSED, null); fireConnectionStateChanged(e); TransportStateEvent.STATE_CLOSED, iox); fireConnectionStateChanged(e);
TransportStateEvent.STATE_CLOSED, null); fireConnectionStateChanged(e); } catch (IOException ex) { logger.error(ex); TransportStateEvent.STATE_CLOSED, iox); fireConnectionStateChanged(e); } catch (IOException ex) { logger.error(ex);
STATE_DISCONNECTED_REMOTELY, null); fireConnectionStateChanged(e); return;
STATE_DISCONNECTED_REMOTELY, null); fireConnectionStateChanged(e); return;