Inheritance: implements Thruway\Transport\TransportInterface
 public function startTransportProvider(AbstractPeer $peer, LoopInterface $loop)
 {
     // the peer that is passed into here is the server that our internal client connects to
     $this->peer = $peer;
     // create a new transport for the router side to use
     $transport = new InternalClientTransport($this->internalClient, $loop);
     // create a new transport for the client side to use
     $clientTransport = new InternalClientTransport($this->peer, $loop);
     // give the transports each other because they are going to call directly into the
     // other side
     $transport->setFarPeerTransport($clientTransport);
     $clientTransport->setFarPeerTransport($transport);
     // connect the transport to the Router/Peer
     $this->peer->onOpen($transport);
     // open the client side
     $this->internalClient->onOpen($clientTransport);
     // tell the internal client to start up
     $this->internalClient->start();
 }
 public function handleRouterStart(RouterStartEvent $event)
 {
     /** @var Session $session */
     $session = null;
     // create a new transport for the client side to use
     $clientTransport = new InternalClientTransport(function ($msg) use(&$session) {
         $session->dispatchMessage(Message::createMessageFromArray(json_decode(json_encode($msg))));
     }, $this->loop);
     // create a new transport for the router side to use
     $transport = new InternalClientTransport(function ($msg) use($clientTransport) {
         $this->internalClient->onMessage($clientTransport, Message::createMessageFromArray(json_decode(json_encode($msg))));
     }, $this->loop);
     $transport->setTrusted($this->trusted);
     $session = $this->router->createNewSession($transport);
     $this->session = $session;
     // connect the transport to the Router/Peer
     $this->router->getEventDispatcher()->dispatch("connection_open", new ConnectionOpenEvent($session));
     // open the client side
     $this->internalClient->onOpen($clientTransport);
     // internal client shouldn't retry
     $this->internalClient->setAttemptRetry(false);
     // tell the internal client to start up
     $this->internalClient->start(false);
 }