* @return the client mina message gateway
*/
public static AbstractStampyMessageGateway initialize() {
StampyHeartbeatContainer heartbeatContainer = new HeartbeatContainer();
MinaAutoTerminatingClientGateway gateway = new MinaAutoTerminatingClientGateway();
gateway.setPort(1234);
gateway.setHost("localhost");
gateway.setHeartbeat(1000);
RawClientMinaHandler handler = new RawClientMinaHandler();
handler.setHeartbeatContainer(heartbeatContainer);
handler.setGateway(gateway);
gateway.addMessageListener(new IDontNeedSecurity());
gateway.addMessageListener(new ClientMessageValidationListener());
MinaConnectedMessageListener cml = new MinaConnectedMessageListener();
cml.setHeartbeatContainer(heartbeatContainer);
cml.setGateway(gateway);
gateway.addMessageListener(cml);
MinaDisconnectListenerAndInterceptor disconnect = new MinaDisconnectListenerAndInterceptor();
disconnect.setCloseOnDisconnectMessage(false);
gateway.addMessageListener(disconnect);
gateway.addOutgoingMessageInterceptor(disconnect);
disconnect.setGateway(gateway);
gateway.setHandler(handler);
return gateway;
}