code: public void setChannel(@Nonnull InputStream in, @Nonnull OutputStream out,
                             @CheckForNull OutputStream launchLog,
                             @CheckForNull Channel.Listener listener) throws IOException, InterruptedException {
          ChannelBuilder cb = new ChannelBuilder(nodeName,threadPoolForRemoting)
              .withMode(Channel.Mode.NEGOTIATE)
              .withHeaderStream(launchLog);
  
          for (ChannelConfigurator cc : ChannelConfigurator.all()) {
              cc.onChannelBuilding(cb,this);
          }
  
          Channel channel = cb.build(in,out);
          setChannel(channel,launchLog,listener);
      }
docs: Creates a {@link Channel} from the given stream and sets that to this agent.
  
  @param in
  Stream connected to the remote agent. It's the caller's responsibility to do
  buffering on this stream, if that's necessary.
  @param out
  Stream connected to the remote peer. It's the caller's responsibility to do
  buffering on this stream, if that's necessary.
  @param launchLog
  If non-null, receive the portion of data in {@code is} before
  the data goes into the "binary mode". This is useful
  when the established communication channel might include some data that might
  be useful for debugging/trouble-shooting.
  @param listener
  Gets a notification when the channel closes, to perform clean up. Can be null.
  By the time this method is called, the cause of the termination is reported to the user,
  so the implementation of the listener doesn't need to do that again.