use of com.generallycloud.baseio.connector.ReconnectableConnector in project baseio by generallycloud.
the class TestReconnectClient method main.
public static void main(String[] args) throws Exception {
IoEventHandleAdaptor eventHandleAdaptor = new IoEventHandleAdaptor() {
@Override
public void accept(SocketSession session, Future future) throws Exception {
}
};
SocketChannelContext context = new NioSocketChannelContext(new ServerConfiguration("localhost", 8300));
ReconnectableConnector connector = new ReconnectableConnector(context);
connector.setRetryTime(5000);
context.setIoEventHandleAdaptor(eventHandleAdaptor);
context.addSessionEventListener(new LoggerSocketSEListener());
context.setProtocolFactory(new FixedLengthProtocolFactory());
// context.addSessionEventListener(new CloseConnectorSEListener(connector.getRealConnector()));
connector.connect();
ThreadUtil.sleep(Long.MAX_VALUE);
CloseUtil.close(connector);
}
Aggregations