(PUP-744) Create an HTTP session

An HTTP session binds a puppet HTTP connection and an expiration time.
(PUP-744) Refactor to use Net::HTTP factory

Previously, puppet connections were directly responsible for creating
Net::HTTP objects. This was okay because there was only one code path
where new Net::HTTP objects needed to be created.

However, in order to support different connection pool behaviors,
caching and non-caching of Net::HTTP objects, we want to have two pool
implementations, and each of them will need the ability to create
Net::HTTP objects.

This commit creates a factory object for creating Net::HTTP objects,
and has the puppet connection delegate to it.
(PUP-744) Add dummy http pool

This commit adds a DummyPool that doesn't perform any caching of network
connections. It also adds the pool to the context system, but does so
using a Proc to defer evaluation of the pool. This way we are not
loading networking code while bootstrapping puppet.
(PUP-744) Create a pool of puppet HTTP connections

This commit adds a pool for caching puppet network connections. The pool
maintains a hash indexed by site.  Each site refers to an array of
sessions, where each session refers to a puppet HTTP connection and its
timeout.

By default, the pool is expected to store puppet HTTP connections,
`Puppet::Network::HTTP::Connection`, but custom connection types can
be specified via `Puppet::Network::HttpPool.http_client_class#=`

It is expected the consumers of the pool will follow
the pattern:

    conn = pool.take_connection(site)
    # do something with conn
    pool.add_connection(site, conn)

Whenever a connection is (re-)added to the pool, a timeout will be set
by the pool on the connection. The pool does not aggressively reap
connections from the pool.  Instead, when someone calls
`#take_connection`, the pool will lazily close any expired
connection(s).

The timeout exists, because if there is a long delay between the time
that an open connection is added to the pool and when it is taken, the
remote peer may close the connection, e.g. firewall. As a result, we
only want to cache connections for a short time. Currently the timeout
defaults to 15 seconds.
(PUP-744) Ensure connections do not leak

Previously, the dummy and caching pools allowed the caller to take a
connection from the pool and retain ownership of the connection. This is
undesirable because if the caller encounters an exception while using
the connection, then they have to remember to close it, otherwise the
underlying socket will leak.

There is also the issue that a caller may forget to add it back to the
pool before the pool is closed, in which case the socket will again
leak.

This commit changes the api to a block form to ensure connections are
either returned to the pool (even if the caller does a non-local return)
or closed (in the case of a StandardError).
(PUP-744) Retrieve Net::HTTP objects from the current pool

Previously, the puppet connection would lazily create a Net::HTTP
object from its factory. If an HTTP request resulted in a redirect,
the `@connection` instance variable would be overwritten with a new
Net::HTTP object. This made it difficult to reason about the lifecycle
of Net::HTTP objects, especially as some of the puppet connection
methods delegated to the current Net::HTTP object, e.g. `#address`,
which may not have been created yet.

The commit associates a site with each puppet connection. The site is
immutable and identifies the connection. As a result, it is trivial to
ask the puppet connection what its `#address` is. Secondly, it
simplifies the Net::HTTP lifecycle, since we only create them as they
are needed.

This commit changes the puppet connection to obtain Net::HTTP objects
from the current pool, rather than calling the factory directory. The
`with_connection` method ensures persistent HTTP connections are
started before being yielded, and are added back to the pool when
complete.

Unfortunately, the `Puppet::Network::HTTP::Connection#connection`
method is public (see tests). If it is invoked, we obtain a new
Net::HTTP object from the factory, but do not start it. We may want to
issue a deprecation warning.

Finally, the redirect loop needed to be modified, because the return
statement causes a non-local jump, which would prevent the
`with_connection` method from returning the connection to the pool.
(PUP-744) Cache Net::HTTP connections during configurer run

This commit overrides the http_pool binding stored in the context system
with a caching pool implementation. The caching pool is only used for
the duration of the configurer run, which includes both agent and apply
applications.

The pool is closed in an ensure block to ensure any cached connections
are closed. Also the `run_internal` method is marked as private to make
it clear which version callers should use.
(PUP-744) Rename DummyPool to NoCachePool

DummyPool was a bad name, renaming to what it actually does.
(PUP-744) Move connection factory into the pools

Previously, the puppet connection class owned the Net::HTTP factory and
passed it to the pool when requesting a connection. However, the caching
pool only needs the factory when creating a new connection.

This commit makes the factory stateless and pushes it into the
respective pools. The SSL verifier is stateful (contains peer certs)
and remains in puppet's connection class.

When a pool needs to create a connection, it calls back into the puppet
connection object to initialize SSL on the Net::HTTP object. In the case
of the caching poool, it needs to do this before starting the
connection, which will perform TCP connect and SSL handshake.
(PUP-744) Remove unnecessary after each routine
(PUP-744) Remove debugging output

When pluginsync'ing many files, the debug log fills up with messages
about reusing connections. This is not necessary, because we always log
when new connections are created.