{
MinaHandler<E> handler = new MinaHandler<E>(binding);
SocketConnector connector = new SocketConnector();
IoServiceConfig acceptorConfig = connector.getDefaultConfig();
acceptorConfig.setThreadModel(ThreadModel.MANUAL);
SocketSessionConfig scfg = (SocketSessionConfig) acceptorConfig.getSessionConfig();
scfg.setTcpNoDelay(Boolean.getBoolean("amqj.tcpNoDelay"));
Integer sendBufferSize = Integer.getInteger("amqj.sendBufferSize");
if (sendBufferSize != null && sendBufferSize > 0)
{
scfg.setSendBufferSize(sendBufferSize);
}
Integer receiveBufferSize = Integer.getInteger("amqj.receiveBufferSize");
if (receiveBufferSize != null && receiveBufferSize > 0)
{
scfg.setReceiveBufferSize(receiveBufferSize);
}
else if (scfg.getReceiveBufferSize() > MAX_RCVBUF)
{
scfg.setReceiveBufferSize(MAX_RCVBUF);
}
connector.setWorkerTimeout(0);
ConnectFuture cf = connector.connect(address, handler);
cf.join();
IoSession ssn = cf.getSession();