/** * {@inheritDoc} */ @Override public boolean isClosed() { return !this.m_ioSession.isConnected(); }
/** * {@inheritDoc} */ @Override public boolean isConnected() { return this.m_ioSession.isConnected(); }
private void checkClosed() throws IOException { if (!m_ioSession.isConnected()) { throw new IOException("The session has been closed."); } }
private void checkClosed() throws IOException { if (!session.isConnected()) { throw new IOException("The session has been closed."); } }
@Override public void messageReceived(final IoSession session, final Object message) { m_log.debug("Received message: {}", message); if (session.isClosing() || !session.isConnected()) { m_log.debug("Ignoring message on closing session..."); return; } final StunMessage stunMessage = (StunMessage) message; // The visitor will handle the particular message type, allowing for // variation between, for example, client and server visitor // implementations. final StunMessageVisitor visitor = this.m_visitorFactory .createVisitor(session); m_log.debug("Sending message to visitor: {}", visitor); stunMessage.accept(visitor); }
public void operationComplete(final IoFuture ioFuture) { if (!ioFuture.isReady()) { m_log.warn("Future not ready?"); return; } try { m_ioSession = ioFuture.getSession(); } catch (final RuntimeIOException e) { // This seems to get thrown when we can't connect at all. m_log.warn("Could not connect to TURN server at: " + stunServerAddress, e); // m_connectionListener.connectionFailed(); return; } if (m_ioSession == null || !m_ioSession.isConnected()) { m_log.error("Could not create session"); throw new RuntimeIoException("Could not get session"); } // TODO: We should not need this. final TurnStunMessageMapper mapper = new TurnStunMessageMapperImpl(); m_ioSession.setAttribute("REMOTE_ADDRESS_MAP", mapper); final AllocateRequest msg = new AllocateRequest(); m_log.debug("Sending allocate request to write handler..."); m_ioSession.write(msg); } };
if (session == null || !session.isConnected()) { m_log.error("Could not connect to server: {}", this.m_serverAddress);
throw e; if (!session.isConnected())
throw new RuntimeIOException("Could not create session"); if (!session.isConnected()) { throw new RuntimeIOException("Not connected");
if (this.m_ioSession.isClosing() || !this.m_ioSession.isConnected()) { m_log.info("Ignoring binding request for closed session"); return null;
if (this.m_ioSession.isConnected()) { LOG.info("Writing binding request: {} on {}", bindingRequest, this.m_ioSession);