Catch invalid/missing URLs in server config JSON

url.Parse() accepts garbage like "" or "foo bar" without returning an
error. The resulting URLs don't work and cause errors later on, when
it's hard to tell where they came from. I'm working around this by
checking the parsed URL object for a non-empty Scheme component.
Added a utility function ParseURL that does this.
(See issue couchbase/sync_gateway#147)
Oops, fixed bug in last commit

I should learn not to rename a parameter right before committing :-p
Also added a more descriptive error message when a bucket has an invalid
CouchAPIBase, to help track down couchbase/sync_gateway#147
Configurable pool sizes.

This is package global, so it's intended to only be set once before
establishing a pool.  No change after pool initialization is guaranteed
to be applied.
More sensible pool overflow variable application
Return descriptive error on attempt to query views of non-healthy bucket

If the CouchAPIBase property is missing, it's probably because the
bucket isn't in a healthy state, so report the state in the error.
(See couchbase/sync_gateway#147 wherein someone has a bucket that is
permanently stuck in "warmup" state.)
Handle bad MCResponse error assertion

Before this could never happen.  Now it can't compile.
Limit the number of nmv retries to 2*node count

This doesn't actually fix the getbulk thing I was thinking of, but it is
a good idea in general to avoid looping on an unresolvable vb map
Centralize access to connection pools
Remove named error result from *Bucket.refresh

This does not add clarity
Atomically perform bucket refreshes

This should make things considerably less racy under failure.  Needs
more actual race testing with the race detector, though.

There are numerous caveats here since the bucket is still used both for
generating and parsing bucket descriptions on the wire *and* used to
represent a bucket within a running system.

The parts we expect to change may now do so freely.

cbugg: close bug-909 bug-903 bug-853
Don't panic on a connection return to a closed pool

Just close the connection and carry on with life.

cbugg: close bug-912
incorrectly compared number of attempts against MaxBulkRetries
Use the correct server list to create connection pools

cbugg: close bug-915
Also use the newly parsed bucket's data for nodelist and vbm
Only consider healthy nodes for random view URL

cbugg: close bug-907
refresh() the new bucket info from a random server

If the chosen random server fails, it tries the next one, and loops over
the nodes list until it tries all the nodes. This way, even if the
original node that the couchbase client connected to dies, everything
would keep working.

cbugg: close bug-910 bug-918
Fixed the "defer" statement in Do() retry loop.

Encapsulated the code block that does the defer call within an anonymous
function. This way defer statement works properly and returns every
connection after each retry.

cbugg: close bug-917
Take out the condition for nmv checks
Further localize closed conn pull conn return

I only need to do this in the healthy case, as that's the only place a
panic from a send to a closed channel is expected.
Document some pool params