use of com.firenio.component.ReConnector in project baseio by generallycloud.
the class TestReconnectClient method main.
public static void main(String[] args) throws Exception {
IoEventHandle eventHandleAdaptor = new IoEventHandle() {
@Override
public void accept(Channel ch, Frame frame) throws Exception {
}
};
ChannelConnector context = new ChannelConnector(8300);
ReConnector connector = new ReConnector(context);
connector.setRetryTime(5000);
context.setIoEventHandle(eventHandleAdaptor);
context.addChannelEventListener(new LoggerChannelOpenListener());
context.addProtocolCodec(new LengthValueCodec());
// context.addChannelEventListener(new CloseConnectorSEListener(connector.getRealConnector()));
connector.connect();
int count = 99999;
for (int i = 0; ; i++) {
Util.sleep(1000);
if (i > count) {
break;
}
}
Util.close(connector);
}
Aggregations