=finagle-mux: flake WindowedByteCounterTest to unblock release

RB_ID=499125
TBR=true
NO-QUEUE=true
Improve Buf constructor and extractor APIs

Problems:

- Buf <-> ChannelBuffer conversion may do wasteful wrapping in some cases
- Converting a Buf to an Array[Byte] is a common task; and there is no convenient reusable way to do this.
- Semantics around when data is copied or potentially mutable is not clear.

Solution:

- Introduce explicit Copied and Direct semantics for all Buf types.
- Do not directly expose mutable data structures from Buf types.
- Introduce 'coerce' functions to support casting of Buf types.
- Introduce 'extract' functions to help with coersion+access.
- Deprecate old (ambiguous) constructors.

Result:
- More predictable use of Buf.
- Significant allocation improvements for Buf.equals, Buf.hash, etc

RB_ID=461763
 Finagle: Add Kerberos client support to SpnegoAuthenticator

 - COORD1222: Add kerberos support for finagle client

 Problem:

 There is was no way to kerberos authenticate a request from a finagle kerberos client.

 Solution:

 Add a ClientFilter to the finagle-http SpnegoAuthenticator.

 Result:

 If you create a Finagle Http Client and wrap it in the SpnegoAuthenticator.ClientFilter one can connect to a kerberos authenticated service.

 Updated the kerberos-http-example project to demonstrate how to create a kerberos authenticated client.

RB_ID=493077
finagle-core: Add blurb on user guide about "exn/*" stats scope

The user guide's Metrics page doesn't currently list the "exn" scope
under which Netty-level exceptions are recorded. This change adds such
a blurb and a proper Scaladoc for `ChannelStatsHandler`.

RB_ID=498957
Adaptors for services of other HTTP types to HTTPx

Problem

We need an adaptor for services that use Netty types to
interoperate with Finagle service builders that expect
Finagle types. This allows services to upgrade to HTTPx
easily, and provides a path for decoupled migration in a
scenario where multiple projects rely on the same Finagle
dependency.

Solution

We implement the adaptor as a filter. This filter provides
interoperability between an HTTPx service builder and a
service using old-style HTTP types, e.g.

    val service = Service.mk[http.Request, http.Response]
    val server = Httpx.serve(":*", HttpAdaptor andThen service)

Result

Using this adaptor, projects now have an incremental
migration path from old-style HTTP services to HTTPx.

RB_ID=497155
TBR=true
finagle-mux: Leasing EndToEndTest

Problem

We weren't sure whether leasing still worked or not

Solution

Add an end to end leasing test

RB_ID=497421
Cut over from maven publishing to pants publishing.

RB_ID=502437
finagle-core SingletonPool: close underlying

Problem

The SingletonPool failed to close the underlying factory when it
itself was closed. On the face of it, that isn't too bad, except that
if the host went into fail-fast mode BEFORE its factory was closed. In
this case, fail-fast would persist and attempt to reconnect to the
host every 32 seconds.

RB_ID=502817
finagle-stream: Unflaky tests

Problem

Finagle-stream tests are currently marked as flaky.
I believe it was for environmental reason (CI infrastructure), indeed those tests
start a server and a client and use a real tcp connection for the communication.
In the past, port and fd exhaustion have cause test failure.

Solution

Unflaky all the tests in finagle-stream project.

RB_ID=503019
Kill maven, kill it with fire

Removes all pom.xml files except:
 scrooge/scrooge-maven-plugin/pom.xml
 macaw-swift/**/pom.xml
 parents/**/pom.xml

RB_ID=502053
TBR=true
finagle-core: Add StackRegistry for both clients and servers

Problem

We need a uniform way to register finagle clients and server
for dynamic introspection in twitter-server.

Solution

Introduce StackRegistry which ClientRegistry and ServerRegistry
implement.

RB_ID=481141
finagle-httpx-compat: fix flaky FiltersTest

RB_ID=503627
Fix TraceId equality

Problem

TraceId cannot be used as a hash key as the hashCode is the default
hashCode of a case class which is based on all fields. However the
equals method only takes into account traceId, parentId, and spanId.

Solution

Override the hashCode method in TraceId to only take into account
traceId, parentId, and spanId.

Result

TraceId can be used as a key for the hash map of buffered spans.

RB_ID=504661
finagle-core: Made ServerChannelConfigurationTest more patient

Problem

"org.scalatest.exceptions.TestFailedException: Expected exception
com.twitter.finagle.ChannelClosedException to be thrown, but
com.twitter.finagle.ChannelWriteException was thrown."  This seems
to indicate that we expect to get a ChannelClosedException but we
actually weren't able to start writing bytes over the wire because
we were still establishing a connection.

Solution

Made it more patient.

RB_ID=504977
Do not double trace memcached calls

Problem

The memcached client was double recording trace events

Solution

Remove the old filter in favor of the new one.

Result

Proper tracing of memcached calls

RB_ID=503411
finagle-stream: Made E2E test more patient

RB_ID=504917
Remove more poms

Not sure how these slipped by last time, removing more poms. Will skip adding the rest of the company out of shame and since they already shipited it.

RB_ID=505101
TBR=true
NO-QUEUE=true
finagle-doc: Improve rst markup for change log

Problem

Finagle's change log was being indexed in a non-standard fashion
on the doc site. (http://twitter.github.io/finagle/guide/)

Solution

Fix the rst markup so that we link to the most recent versions
and change log categories aren't part of the index.

RB_ID=501451
finagle/util - Make multithreaded tests more patient

Problem

By default, the `eventually` method in scalatest times the test out
after 150 milliseconds.  This makes some of our unit tests appear flaky
when random pauses or busy CI machines stall on test execution.  The
symptom of these types of failures look like this:

       org.scalatest.exceptions.TestFailedDueToTimeoutException: The
       code passed to eventually never returned normally. Attempted 1
       times over 159.628854 milliseconds.

The default patience config for scalatest[1] should try every 15ms, so
with only one retry it's clear that the CI machine is slowed for some
reason.

Solution

Mix in the IntegrationPatience trait which increases the timeout of the
`eventually` to 15 seconds.

1. http://www.artima.com/docs-scalatest-2.0.M5/org/scalatest/concurrent/PatienceConfiguration.html

RB_ID=504031
Finagle-memcached cas() to match on NotFound()

Problem:
TimelineService has discovered that memcached's cas() operation can return a NotFound() state when the key being set no longer exists. This is not checked for in the finagle client and will instead throw an IllegalStateException.

Solution:
Add the case matching NotFound() which will return false for the operation.

Results:
For cas operations in which the key has been deleted between operations, it will return false. This matches current understanding that the existing key attempting to be written has been changed since last check.

RB_ID=503161