code: public final Expect build() throws IOException {
          if (inputs == null || inputs.length == 0) {
              throw new IllegalStateException("Inputs are null or empty");
          }
  
          if (echoInputs != null && echoInputs.length != 0
                  && echoInputs.length != inputs.length - 1) {
              throw new IllegalArgumentException(
                      "The number of echo input does not correspond to the total "
                              + "number of the input streams");
          }
  
          SingleInputExpect[] inputs = new SingleInputExpect[this.inputs.length];
          Pipe pipe = null;
          Pipe.SourceChannel source = null;
          Pipe.SinkChannel sink = null;
          for (int i = 0; i < inputs.length; i++) {
              if (!combineInputs || pipe == null) {
                  pipe = Pipe.open();
                  source = pipe.source();
                  sink = pipe.sink();
              }
              inputs[i] = new SingleInputExpect(
                      source,
                      sink,
                      this.inputs[i],
                      charset,
                      getEchoInputForIndex(i),
                      filter,
                      bufferSize,
                      autoFlushEcho);
          }
  
          if (echoOutputOld != null) {
              echoOutput = new AppendableAdapter() {
                  @Override
                  public Appendable append(CharSequence csq) throws IOException {
                      echoOutputOld.onSend(csq.toString());
                      return this;
                  }
              };
          }
          ExpectImpl instance = new ExpectImpl(
                  timeout,
                  output,
                  inputs,
                  charset,
                  echoOutput,
                  errorOnTimeout,
                  lineSeparator,
                  exceptionOnFailure,
                  autoFlushEcho,
                  executor);
          instance.start();
          return instance;
      }
docs: Creates a ready to use {@link Expect} instance.
  <p/>
  This method creates an instance and starts background threads that receive input data
  through NIO pipes. The
  created instance must be disposed after use by calling the {@link net.sf.expectit
  .Expect#close()}  method,
  <p/>
  The instance is not thread safe and intended to be used in a single thread.
  
  @return the instance
  @throws java.io.IOException                     if I/O error occurs
  @throws java.lang.IllegalStateException if the {@code inputs} are incorrect