package com.eactive.eai.adapter.socket2.protocol;

import com.eactive.eai.adapter.socket2.config.SocketAdapterContext;
import edu.emory.mathcs.backport.java.util.concurrent.Executor;
import org.apache.mina.common.support.BaseIoConnector;
import org.apache.mina.common.support.BaseIoConnectorConfig;
import org.apache.mina.transport.socket.nio.SocketConnector;
import org.apache.mina.transport.socket.nio.SocketConnectorConfig;


public abstract class TcpAdapterClient extends SocketAdapterClient {
	protected TcpAdapterClient(SocketAdapterContext context) throws Exception {
		super(context);
	}

	protected BaseIoConnectorConfig createConnectorConfig() {
		return new SocketConnectorConfig();
	}
	
	protected BaseIoConnector createConnector(int ioProcessorCount, Executor ioProcessExecutor) {
		SocketConnector connector = new SocketConnector(ioProcessorCount, ioProcessExecutor, this);
		connector.setWorkerTimeout(1);
		return connector;
	}
}	
