new DefaultIoSessionDataStructureFactory();
// one faker on port 10001
int port1 = 10001;
NioSession session1 = mock(NioSession.class);
session1.setAttributeMap(dsFactory.getAttributeMap(session1));
SocketAddress sockAddr1 = new InetSocketAddress(localAddr, port1);
when(session1.getLocalAddress()).thenReturn(sockAddr1);
// another faker on port 10002
int port2 = 10002;
NioSession session2 = mock(NioSession.class);
session2.setAttributeMap(dsFactory.getAttributeMap(session2));
SocketAddress sockAddr2 = new InetSocketAddress(localAddr, port2);
when(session2.getLocalAddress()).thenReturn(sockAddr2);
// set up expected charsets per port
ConcurrentMap<Integer, ThreadSafeDecoder> portCharsets =
new ConcurrentHashMap<Integer, ThreadSafeDecoder>();
portCharsets.put(port1, new ThreadSafeDecoder(Charsets.ISO_8859_1));