public Echo(Options options)
{
log.Info("creating echo host");
log.DebugFormat("create interprocess input pipe (handle={0})", options.pipeIn);
pipeIn = new AnonymousPipeClientStream(PipeDirection.In, options.pipeIn);
pipeReader = new StreamReader(pipeIn);
log.DebugFormat("create interprocess output pipe (handle={0})", options.pipeOut);
pipeOut = new AnonymousPipeClientStream(PipeDirection.Out, options.pipeOut);
pipeWriter = new StreamWriter(pipeOut);
log.Debug("create native messaging port");
port = new Port(pipeIn, pipeOut);
log.Debug("create stop event");
stop = new ManualResetEvent(false);
log.Debug("synchronize processes");
string sync = pipeReader.ReadLine();
log.DebugFormat("sent {0}", sync);
pipeWriter.WriteLine(sync);
pipeWriter.Flush();
log.DebugFormat("received {0}", sync);
pipeOut.WaitForPipeDrain();
log.Info("created echo host");
}