protected function buildStreamContext($method, $headers, $body) {
    // Construct the stream options.
    $headers['Connection'] = 'close';
    $config = array(
      'http' => array(
        'protocol_version' => $this->httpVersion,
        'method' => strtoupper($method),
        'header' => $this->smashHeaders($headers),
        'user_agent' => Transporter::HTTP_USER_AGENT . self::HTTP_USER_AGENT_SUFFIX,
      ),
    );

    if (!empty($body)) {
      $config['http']['content'] = $body;
    }

    if (\HPCloud\Bootstrap::hasConfig('transport.timeout')) {
      $config['http']['timeout'] = (float) \HPCloud\Bootstrap::config('transport.timeout');
    }

    // Set the params. (Currently there is only one.)
    $params = array();
    if (!empty($this->notificationCallback)) {
      $params['notification'] = $this->notificationCallback;
    }
    // Enable debugging:
    elseif (\HPCloud\Bootstrap::hasConfig('transport.debug') && \HPCloud\Bootstrap::config('transport.debug')) {
      //fwrite(STDOUT, "Sending debug messages to STDOUT\n");
      $params['notification'] = array($this, 'printNotifications');
    }

    // Build the context.
    $context = stream_context_create($config, $params);

    return $context;
  }