@Override public void initChannel(final LocalChannel serverChannel) throws Exception { ChannelPipeline p = serverChannel.pipeline(); p.addLast(new LoggingHandler("localServerBootstrp Handler 4", LogLevel.TRACE)); // call this first so that the attribute will be visible // to the outside once the localAddress is set serverChannel.attr(SESSION).setIfAbsent(SettableFuture.<UscSessionImpl> create()); // register the child channel by address for lookup // outside LocalAddress localAddress = serverChannel.remoteAddress(); serverChannels.putIfAbsent(localAddress, SettableFuture.<LocalChannel> create()); serverChannels.get(localAddress).set(serverChannel); p.addLast(new LoggingHandler("localServerBootstrp Handler 3", LogLevel.TRACE)); // add remote device handler for route remote request p.addLast(remoteDeviceHandler); p.addLast(new LoggingHandler("localServerBootstrp Handler 2", LogLevel.TRACE)); p.addLast(getMultiplexer()); p.addLast(new LoggingHandler("localServerBootstrp Handler 1", LogLevel.TRACE)); } });
serverChannel.attr(SESSION).get().set(session); serverChannel.attr(CLIENT_CHANNEL).set(clientChannel); LOG.info("Connected with channel for " + session); } else if (directChannel != null) { clientChannel.attr(LOCAL_SERVER_CHANNEL).set(serverChannel); serverChannel.attr(DIRECT_CHANNEL).set(directChannel); serverChannel.attr(CLIENT_CHANNEL).set(clientChannel); directChannel.attr(LOCAL_SERVER_CHANNEL).set(serverChannel); LOG.info("Connected channel using direct way for " + device); address.getPort()); clientChannel.attr(ROUTE_IDENTIFIER).setIfAbsent(routeId); serverChannel.attr(ROUTE_IDENTIFIER).setIfAbsent(routeId); sendEvent(new UscChannelCreateEvent(remoteChannel.getIp(), true, remoteChannel.getRemoteChannelType()));
Channel clientChannel = serverChannel.attr(UscPlugin.CLIENT_CHANNEL).get(); if(controlMsg.getControlCode() == UscControl.ControlCode.TERMINATION_REQUEST) { LOG.trace("UscDemultiplexer received control message TERMINATION_REQUEST");