Search in sources :

Example 1 with ShutdownArgs

use of com.github.dreamhead.moco.bootstrap.ShutdownArgs in project moco by dreamhead.

the class ShutdownTask method run.

@Override
public void run(final String[] args) {
    ShutdownArgs shutdownArgs = parse(args);
    client.run("127.0.0.1", shutdownArgs.getShutdownPort().get(), new ChannelInitializer<SocketChannel>() {

        @Override
        protected void initChannel(final SocketChannel ch) throws Exception {
            ChannelPipeline pipeline = ch.pipeline();
            pipeline.addLast("encoder", new StringEncoder());
            pipeline.addLast("handler", new ShutdownHandler());
        }
    });
}
Also used : StringEncoder(io.netty.handler.codec.string.StringEncoder) SocketChannel(io.netty.channel.socket.SocketChannel) ShutdownArgs(com.github.dreamhead.moco.bootstrap.ShutdownArgs) ConnectException(java.net.ConnectException) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

ShutdownArgs (com.github.dreamhead.moco.bootstrap.ShutdownArgs)1 ChannelPipeline (io.netty.channel.ChannelPipeline)1 SocketChannel (io.netty.channel.socket.SocketChannel)1 StringEncoder (io.netty.handler.codec.string.StringEncoder)1 ConnectException (java.net.ConnectException)1