@@ -0,0 +1,3323 @@
+/*%0A * Copyright 2012-2014 TORCH GmbH%0A *%0A * This file is part of Graylog2.%0A *%0A * Graylog2 is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * Graylog2 is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A *%0A * You should have received a copy of the GNU General Public License%0A * along with Graylog2.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A%0Apackage org.graylog2.gelfclient.transport;%0A%0Aimport io.netty.bootstrap.Bootstrap;%0Aimport io.netty.channel.ChannelFuture;%0Aimport io.netty.channel.ChannelFutureListener;%0Aimport io.netty.channel.ChannelInitializer;%0Aimport io.netty.channel.EventLoopGroup;%0Aimport io.netty.channel.nio.NioEventLoopGroup;%0Aimport io.netty.channel.socket.SocketChannel;%0Aimport io.netty.channel.socket.nio.NioSocketChannel;%0Aimport org.graylog2.gelfclient.Configuration;%0Aimport org.graylog2.gelfclient.GelfMessage;%0Aimport org.graylog2.gelfclient.GelfMessageEncoder;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A/**%0A * @author Bernd Ahlers %3Cbernd@torch.sh%3E%0A */%0Apublic class GelfTcpTransport implements GelfTransport %7B%0A    private final Logger LOG = LoggerFactory.getLogger(GelfTcpTransport.class);%0A    private final Configuration config;%0A    private final GelfMessageEncoder encoder;%0A%0A    private final EventLoopGroup workerGroup;%0A    private final Bootstrap bootstrap;%0A    private final GelfTcpChannelHandler handler;%0A    private final ChannelFuture channelFuture;%0A%0A    public GelfTcpTransport(Configuration config, GelfMessageEncoder encoder) %7B%0A        this.config = config;%0A        this.encoder = encoder;%0A%0A        this.workerGroup = new NioEventLoopGroup();%0A        this.bootstrap = new Bootstrap();%0A        this.handler = new GelfTcpChannelHandler(config, encoder);%0A%0A        bootstrap.group(workerGroup)%0A                .channel(NioSocketChannel.class)%0A                .remoteAddress(config.getHost(), config.getPort())%0A                .handler(new ChannelInitializer%3CSocketChannel%3E() %7B%0A                    @Override%0A                    protected void initChannel(SocketChannel ch) throws Exception %7B%0A                        ch.pipeline().addLast(handler);%0A                    %7D%0A                %7D);%0A%0A        this.channelFuture = bootstrap.connect();%0A%0A        channelFuture.addListener(new ChannelFutureListener() %7B%0A            @Override%0A            public void operationComplete(ChannelFuture future) throws Exception %7B%0A                if (future.isSuccess()) %7B%0A                    LOG.debug(%22Connected!%22);%0A                %7D else %7B%0A                    LOG.error(%22Connection failed%22, future.cause());%0A                    future.cause().printStackTrace();%0A                %7D%0A            %7D%0A        %7D);%0A    %7D%0A%0A    @Override%0A    public void send(GelfMessage message) %7B%0A        handler.send(message);%0A    %7D%0A%0A    @Override%0A    public void stop() %7B%0A        handler.stop();%0A        workerGroup.shutdownGracefully();%0A    %7D%0A%0A    @Override%0A    public void sync() throws InterruptedException %7B%0A        channelFuture.sync();%0A    %7D%0A%7D%0A

Add GELF TCP transport class.