Fix StartTLS as it wasn't working.

*) Remove direct writes to the connection.

*) StartTLS can be done at any time, not just at the start of the connection (see
RFC 4513 3.1.1) except when TLS is not already estabilished, there isn't a SASL
multistage negotiation in progress and there are no outstanding responses.

For this reason this patch adds a counter on outstanding requests and checks
them before doing startTLS (and forbirds requests during the startTLS phase).

To avoid concurrency problems these counters should be protected by a lock.
This is done inside sendMessage which is the last point where an error can be
returned to the caller and it's the entry point for every function that wants
to send a packet.

*) The reader goroutine should be stopped after receiving the response to the
startTLS request or it will block on ber.ReadPacket and error out trying to
decode the tls handshake data as ber packets. After a successfull handshake it
will be restarted with the new tls connection handler.
Add TLS and StartTLS tests:

*) Connection tests for TLS and StartTLS.
*) Multi goroutine search for TLS and StartTLS
*) Test StartTLS and a search after a previous unencrypted search on the same connection.
Add a searchStartTLS example that will firstly do the search without tls and
then issue a StartTLS and redo the same search.
Merge pull request #5 from sgotti/fixstarttlsv2

Fix broken StartTLS