}
channel.writeAndFlush(data + "\n");
}
protected void _connect(String host, int port) {
Bootstrap b = new Bootstrap();
if (!context.addGroup(b)) {
Flog.warn("no loopgroup, will not reconnect");
return;
}
b.channel(NioSocketChannel.class);
b.option(ChannelOption.SO_KEEPALIVE, true);
b.option(ChannelOption.TCP_NODELAY, true);
b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 15*1000);
b.handler(new FlooChannelInitializer(this));
try {
ChannelFuture connect = b.connect(host, port);
channel = connect.channel();
} catch (RejectedExecutionException e) {
context.errorMessage("Can not connect to floobits!");
context.shutdown();
} catch (Throwable e) {