List of usage examples for io.netty.channel.socket DefaultSocketChannelConfig DefaultSocketChannelConfig
public DefaultSocketChannelConfig(SocketChannel channel, Socket javaSocket)
From source file:org.fusesource.hawtdispatch.netty.HawtSocketChannel.java
License:Apache License
/** * Create a new instance/*from w ww . ja v a2s. co m*/ * * @param parent the {@link Channel} which created this instance or {@code null} if it was created by the user * @param id the id to use for this instance or {@code null} if a new one should be generated * @param socket the {@link java.nio.channels.SocketChannel} which will be used */ public HawtSocketChannel(HawtServerSocketChannel parent, Integer id, java.nio.channels.SocketChannel socket) { super(parent, id, socket); try { socket.configureBlocking(false); } catch (IOException e) { try { socket.close(); } catch (IOException e2) { if (logger.isWarnEnabled()) { logger.warn("Failed to close a partially initialized socket.", e2); } } throw new ChannelException("Failed to enter non-blocking mode.", e); } config = new DefaultSocketChannelConfig(this, socket.socket()); }