private NioSocketConnector createConnector(CountDownLatch authenticatedLatch) {
NioSocketConnector connector = new NioSocketConnector();
DefaultIoFilterChainBuilder filterChainBuilder = new DefaultIoFilterChainBuilder();
filterChainBuilder.addLast("xmppCodec", new ProtocolCodecFilter(new XMPPProtocolCodecFactory()));
filterChainBuilder.addLast("loggingFilter", new StanzaLoggingFilter());
connector.setFilterChainBuilder(filterChainBuilder);
connector.setHandler(new ConnectorIoHandler(authenticatedLatch));
return connector;
}