Last active
December 17, 2015 15:09
-
-
Save ryanobjc/5629767 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The code snippet: | |
Bootstrap b2 = new Bootstrap(); | |
b2.group(childGroup) | |
.option(ChannelOption.TCP_NODELAY, true) | |
.channel(NioSocketChannel.class) | |
.handler(new ChannelInitializer<SocketChannel>() { | |
@Override | |
protected void initChannel(SocketChannel ch) throws Exception { | |
ch.pipeline().addLast("stringEncoder", new StringEncoder(BufType.BYTE, CharsetUtil.UTF_8)); | |
} | |
}); | |
Channel peerChannel = b2.connect(remotePeerAddr).channel(); | |
peerChannel.write("42"); // Line 168 | |
Exception in thread "main" java.lang.NullPointerException | |
at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:1527) | |
at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:1136) | |
at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:878) | |
at io.netty.channel.AbstractChannel.write(AbstractChannel.java:246) | |
at Main.run(Main.java:167) | |
at Main.main(Main.java:85) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:601) | |
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment