Skip to content

Instantly share code, notes, and snippets.

@jimbaker
Created March 5, 2015 18:48
Show Gist options
  • Select an option

  • Save jimbaker/177da070a0e70b9ac97c to your computer and use it in GitHub Desktop.

Select an option

Save jimbaker/177da070a0e70b9ac97c to your computer and use it in GitHub Desktop.
Expect to get java.net.ConnectException from the ChannelFuture, getting this exception printed and no return from the synced future
test_socket
testClosedSocket (test.test_socket.TestJythonTCPExceptions) ... 2015-03-05 11:34:33,260 MainThread DEBUG setsockopt Setting option 128 to 1 <_realsocket at 0x2 type=unknown open_count=1 channel=None timeout=None>
ok
testConnectionRefused (test.test_socket.TestJythonTCPExceptions) ... 2015-03-05 11:34:33,276 MainThread DEBUG setsockopt Setting option 128 to 1 <_realsocket at 0x3 type=unknown open_count=1 channel=None timeout=None>
2015-03-05 11:34:33,276 MainThread DEBUG _connect Begin connection to ('localhost', 50100) <_realsocket at 0x3 type=unknown open_count=1 channel=None timeout=None>
2015-03-05 11:34:33,286 MainThread DEBUG _get_jsockaddr Address localhost/127.0.0.1:50100 for ('localhost', 50100) *
2015-03-05 11:34:33,288 MainThread DEBUG __init__ Initializing inbound handler <_realsocket at 0x3 type=client open_count=1 channel=None timeout=None>
2015-03-05 11:34:33,290 MainThread DEBUG _connect Connect 0.0.0.0/0.0.0.0:0 to localhost/127.0.0.1:50100 <_realsocket at 0x3 type=client open_count=1 channel=None timeout=None>
2015-03-05 11:34:33,342 MainThread DEBUG _handle_channel_future Syncing on future AbstractBootstrap$PendingRegistrationPromise@4b57fd2c(success) for local bind <_realsocket at 0x3 type=client open_count=1 channel=None timeout=None>
2015-03-05 11:34:33,351 MainThread DEBUG _handle_channel_future Syncing on future DefaultChannelPromise@2381df09(uncancellable) for connect <_realsocket at 0x3 type=client open_count=1 channel=[id: 0x4a93291d, /0:0:0:0:0:0:0:0:60825] timeout=None>
Mar 05, 2015 11:34:33 AM io.netty.channel.nio.NioEventLoop run
WARNING: Unexpected exception in the selector loop.
io.netty.channel.ChannelException: java.net.SocketException: Socket is closed
at io.netty.channel.socket.DefaultSocketChannelConfig.getSoLinger(DefaultSocketChannelConfig.java:150)
at io.netty.channel.socket.nio.NioSocketChannel$NioSocketChannelUnsafe.closeExecutor(NioSocketChannel.java:335)
at io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:568)
at io.netty.channel.AbstractChannel$AbstractUnsafe.closeIfClosed(AbstractChannel.java:797)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:269)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:284)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.net.SocketException: Socket is closed
at sun.nio.ch.Net.translateToSocketException(Net.java:105)
at sun.nio.ch.SocketAdaptor.getIntOption(SocketAdaptor.java:319)
at sun.nio.ch.SocketAdaptor.getSoLinger(SocketAdaptor.java:339)
at io.netty.channel.socket.DefaultSocketChannelConfig.getSoLinger(DefaultSocketChannelConfig.java:148)
... 11 more
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.getOption(SocketChannelImpl.java:197)
at sun.nio.ch.SocketAdaptor.getIntOption(SocketAdaptor.java:317)
... 13 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment