[finagle-http] Increase test coverage

Problem

Test coverage is thin in some parts of finagle-http.

Solution

More tests to increase coverage.

Result

Increased line and branch coverage in finagle-http.

                   line         branch
c.t.f.http         75% => 86%   29% => 35%
c.t.f.http.codec   76% => 94%   53% => 72%
c.t.f.http.filter  84% => 95%   (no change)
c.t.f.http.path    62% => 89%   16% => 40%
c.t.f.http.service 97% => 100%  (no change)

RB_ID=539092
[finagle-httpx] Remove deprecated code, shrink access

Problem

Deprecated code in http was copied over when we created httpx.
This is a good time to get rid of it (i.e. before people start
using httpx directly), and also shrink the access scope of
things that should be private to httpx/finagle.

Solution

Remove deprecated code and shrink access to internals.

Result

Leaner meaner httpx.

RB_ID=539076
finagle-mux/thriftmux: Remove socket close race / Drain downgraded sessions correctly

Problem

When a ThriftMux server downgrades a connection to thrift, we fail
to drain gracefully. There were two problems that contributed to this.
First, the downgrade pipeline didn't respond with an Rdrain so the mux
server dispatcher never moved into a draining state. Secondly, the transport
close raced against the server's final writes.

Solution

Synthesize Rdrain in thriftmux and serialize the close with the final write.

RB_ID=539596
finagle-core: deprecate InetAddressUtil.Loopback

Problem:

InetAddress.getByAddress(Array[Byte](127,0,0,1)) is outdated. Java 7 provides
java.net.InetAddress.getLoopbackAddress for loopback address.

Solution:

Deprecate InetAddressUtil.Loopback, use java.net.InetAddress.getLoopbackAddress
everywhere.

RB_ID=535601
3rdparty/BUILD: split up into package dirs - part 12

RB_ID=540490
TBR=true
finagle-thriftmux: properly scope downgrade pipeline

RB_ID=540672
finagle-branchmark: use `status` instead of `isOpen`

Problem

finagle-benchmark is not compiling because it used `transport.isOpen`
which is now removed in favor of `transport.status`

Solution

Replace the calls to isOpen with their new equivalent.

RB_ID=541720
3rdparty/BUILD: split up into package dirs - part 14

RB_ID=540856
TBR=true
Enable Scala 2.11 SBT builds for util-eval, ostrich, and finagle-ostrich4

Problem

We want to publish 2.11 releases of Finagle subprojects that depend on Ostrich,
which we have not previously built for 2.11 (because it has specs tests, and
because it depends on scala-json and util-eval, neither of which previously
worked on 2.11).

Solution

util-eval previously didn't work on 2.11 because `scala.ScalaObject` has been
removed since 2.10. This is fixed here. The bulk of this commit is Rodrigo
Lazoti's migration of Ostrich's tests from specs to ScalaTest (I'm not using his
pull request since the PR also replaces scala-json with Jackson, which we don't
want to do at this time to avoid breaking public APIs). This commit also
reinstates util-eval and the Finagle subprojects that depend on Ostrich in their
projects' cross-builds.

Result

util-eval, ostrich, finagle-ostrich4, finagle-example, and finagle-stress all
build and pass tests on 2.11 (from SBT) for the first time.

RB_ID=534127
finagle-sbt: exclude kestrelx from unidoc task

this is a temporary fix until the kestrel-x package
is removed after the netty4 migration is complete.

RB_ID=542284
finagle-thriftmux: Add test for ThriftMux client, Thrift server

Problem

No test coverage for the behavior of a ThriftMux client
talking to a Thrift server.

Solution

Add a test case that exhibits the expected, unsupported
behavior.

RB_ID=541776
[finagle-httpx] Increase test coverage

Problem

Test coverage is thin in some parts of finagle-httpx.

Solution

More tests to increase coverage.

Result

                    line         branch
c.t.f.httpx         76% => 83%   30% => 33%
c.t.f.httpx.codec   75% => 93%   52% => 70%
c.t.f.httpx.filter  84% => 95%   46% => 46%
c.t.f.httpx.netty   78% => 90%   44% => 44%
c.t.f.httpx.path    62% => 89%   16% => 40%
c.t.f.httpx.service 97% => 100%  50% => 50%

RB_ID=541474
finagle-core: Make MaskCancelFilter.Param public so it can be configured

Problem

MaskCancelFilter.Param is private to finagle and so can't be configured for servers

RB_ID=542728
[finagle-http/x] Fix flaky streaming tests

Problem

Some streaming tests are flaky because of a race between
discarding a Writable and writing to it. The test assumes
that discard happens before the write, causing the write to
expectedly fail. However, sometimes the write happens
before.

Solution

Write repeatedly so that even if we write early, subsequent
writes will come after the discard. This is likely because
subsequent writes wait for antecedent writes to complete.

Result

Passes on 1000 test runs.

RB_ID=541456
[trivial] Fix example client configuration in FAQ

Problem

We don't yet support HTTPS with the fetchUrl API, but the examples in
our documentation suggests we do.

Solution

Update the docs.

RB_ID=541476
finagle-mux: mock network in discard test

Problem

Our CI seems to have an issue with this particular test.
I couldn't see any issues other than environment specific
network issues.

Solution

Mock the network via AsyncQueues. This omits some of the modules
in between, but I think it still tests the behavior in question.

RB_ID=532115
finagle-core: remove Context.letEnv; add shadowing Context.let

Problem

Context.letEnv had the wrong semantics: the previous environment
should not be discarded (except intentionally through Context.letEnv).
This caused a bug where Client Ids were no longer propagated from
legacy clients.

Solution

Introduce Context.let, with proper shadowing semantics.

RB_ID=543118
Revert "finagle-core: remove Context.letEnv; add shadowing Context.let"

This reverts commit 4ed8aeeae69675ec6ac8ceb5803184a59745ff7d.

RB_ID=543664
TBR=true
finagle-core: Properly pass parameters through in serveAndAnnounce

Problem

serveAndAnnounce(name: String, addr: String, Service[Req, Rep]) tries to
serve on name and announce at addr, which is the opposite of what it
says it does.

Solution

Fix the order of parameters.

Result

Parameters are taken in the right order.

RB_ID=542566
finagle-core: remove Context.letEnv; add shadowing Context.let

Problem

Context.letEnv had the wrong semantics: the previous environment
should not be discarded (except intentionally through Context.letEnv).
This caused a bug where Client Ids were no longer propagated from
legacy clients.

Solution

Introduce Context.let, with proper shadowing semantics.

RB_ID=543820