/** * {@inheritDoc} */ @Override protected NioSession newSession(IoProcessor<NioSession> processor, SocketChannel handle) { return new NioSocketSession(this, processor, handle); }
/** * {@inheritDoc} */ @Override public InetSocketAddress getLocalAddress() { if (channel == null) { return null; } Socket socket = getSocket(); if (socket == null) { return null; } return (InetSocketAddress) socket.getLocalSocketAddress(); }
/** * {@inheritDoc} */ @Override protected NioSession newSession(IoProcessor<NioSession> processor, SocketChannel handle) { final NioSocketSession nioSocketSession = new NioSocketSession(this, processor, handle); // NB: We do not catch the RuntimeIoException for this // call because catching one and returning null leads to NPE. nioSocketSession.initSessionConfig(); return nioSocketSession; }
public boolean isTcpNoDelay() { if (!isConnected()) { return false; } try { return ch.socket().getTcpNoDelay(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public final boolean isSecured() { // If the session does not have a SslFilter, we can return false IoFilterChain chain = getFilterChain(); IoFilter sslFilter = chain.get(SslFilter.class); if (sslFilter != null) { // Get the SslHandler from the SslFilter return ((SslFilter)sslFilter).isSecured(this); } else { return false; } } }
/** * {@inheritDoc} */ @Override public boolean isTcpNoDelay() { if (!isConnected()) { return false; } try { return getSocket().getTcpNoDelay(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public final boolean isSecured() { // If the session does not have a SslFilter, we can return false IoFilterChain chain = getFilterChain(); IoFilter sslFilter = chain.get(SslFilter.class); if (sslFilter != null) { // Get the SslHandler from the SslFilter return ((SslFilter)sslFilter).isSecured(this); } else { return false; } } }
/** * {@inheritDoc} */ @Override protected NioSession newSession(IoProcessor<NioSession> processor, SocketChannel handle) { return new NioSocketSession(this, processor, handle); }
final NioSocketSession session = new NioSocketSession(this, processor, ch); session.initSessionConfig(); return session; } catch (RuntimeIoException e) {
/** * {@inheritDoc} */ @Override public boolean isTcpNoDelay() { if (!isConnected()) { return false; } try { return getSocket().getTcpNoDelay(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public InetSocketAddress getRemoteAddress() { if (channel == null) { return null; } Socket socket = getSocket(); if (socket == null) { return null; } return (InetSocketAddress) socket.getRemoteSocketAddress(); }
return new NioSocketSession(this, processor, ch); } catch (Throwable t) { if(t.getMessage().equals("Too many open files")) {
/** * {@inheritDoc} */ @Override public InetSocketAddress getRemoteAddress() { if (channel == null) { return null; } Socket socket = getSocket(); if (socket == null) { return null; } return (InetSocketAddress) socket.getRemoteSocketAddress(); }
return new NioSocketSession(this, processor, ch); } catch (Throwable t) { if(t.getMessage().equals("Too many open files")) {
/** * {@inheritDoc} */ @Override public InetSocketAddress getLocalAddress() { if (channel == null) { return null; } Socket socket = getSocket(); if (socket == null) { return null; } return (InetSocketAddress) socket.getLocalSocketAddress(); }