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

import com.eactive.eai.adapter.socket2.config.SocketAdapterContext;
import com.eactive.eai.adapter.socket2.protocol.TcpAdapterClient;
import com.eactive.eai.adapter.socket2.protocol.envelop.handshake.EnvelopClientFilter;
import com.eactive.eai.adapter.socket2.protocol.fixedheader.codec.FixedHeaderCodecFactory;
import org.apache.mina.filter.codec.ProtocolCodecFilter;

public class EnvelopClient extends TcpAdapterClient {

	public EnvelopClient(SocketAdapterContext context) throws Exception {
		super(context);
		this.handler = new EnvelopHandler(this);
		
		config.getFilterChain().addFirst("codec", new ProtocolCodecFilter(new FixedHeaderCodecFactory(this)));
		config.getFilterChain().addAfter("codec", "envelop-client", new EnvelopClientFilter(this));
	}
}
