Skip to content

@scramjet /name.mattp.Netty.java
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Example of using a Java wrapper with Netty 4 to work around Clojure bug http://dev.clojure.org/jira/browse/CLJ-1183.
package name.mattp;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ServerChannel;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelHandlerContext;
public class Netty
{
public static ChannelFuture close (Channel channel)
{
return channel.close ();
}
public static ChannelFuture flush (Channel channel)
{
return channel.flush ();
}
public static ChannelFuture write (Channel channel, Object message)
{
return channel.write (message);
}
public static ChannelPipeline pipeline (Channel channel)
{
return channel.pipeline ();
}
public static ServerBootstrap channel (ServerBootstrap bootstrap,
Class<? extends ServerChannel> channelClass)
{
return bootstrap.channel (channelClass);
}
public static Bootstrap clientChannel (Bootstrap bootstrap,
Class<? extends Channel> channelClass)
{
return bootstrap.channel (channelClass);
}
public static Bootstrap group (Bootstrap bootstrap, EventLoopGroup group)
{
return bootstrap.group (group);
}
public static Bootstrap handler (Bootstrap bootstrap,
ChannelHandler handler)
{
return bootstrap.handler (handler);
}
public static Bootstrap option (Bootstrap bootstrap,
ChannelOption option,
Object value)
{
return bootstrap.option (option, value);
}
public static ChannelPipeline pipeline (ChannelHandlerContext ctx)
{
return ctx.pipeline ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.