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));
portCharsets.put(port2, new ThreadSafeDecoder(Charsets.UTF_8));
///////////////////////////////////////////////////////
// channel / source setup
// set up channel to receive events
MemoryChannel chan = new MemoryChannel();
chan.configure(new Context());
chan.start();
ReplicatingChannelSelector sel = new ReplicatingChannelSelector();
sel.setChannels(Lists.<Channel>newArrayList(chan));
ChannelProcessor chanProc = new ChannelProcessor(sel);
// defaults to UTF-8
MultiportSyslogHandler handler = new MultiportSyslogHandler(
1000, 10, chanProc, new SourceCounter("test"), "port",
new ThreadSafeDecoder(Charsets.UTF_8), portCharsets, KEEP_FIELDS);
// initialize buffers
handler.sessionCreated(session1);
handler.sessionCreated(session2);