Merge pull request #61 from Jonux/master

Fixes depedency problem with Java JNA
Copy GerritHandler to GerritConnection

For preparation, simple copy.
Isolate connection feature

* Rename class to GerritConnection in duplicated GerritConnection.java
* Remove unnecessary code in GerritConnection and GerritHandler
* Coodinate StreamWatchdog parameter
Add Connector interface

Coordinator interface cannot be implemented to GerritConnection
since there is no workqueue. So add Connector interface tnen move
reconnection feature to it.
Implement Connection/Handler solution to plugin

gerrithudsontrigger follows new Connection/Handler solution in
gerrit-events. The feature for saving and restoring lisners is
removed since the lifetime of handler equals the ones for plugin.
Add new test class

Add new test class for GerritConnection
Fix tests

Coordinate some tests following new Connection/Handler solution
Merge pull request #64 from rinrinne/connection-isolation-2

Isolate connection
Fix NPE for StreamWatchdog

The instance of StreamWatchdog should be discarded once calling
shutdown. If call twice, NPE is raised.

This patch prevents it.
Fix comments
Fix shutdown process

shutdownInProgress is flag. It is accessed from more than 2 threads.
When read this, it has possibility not to be able to get the latest
value which was written by other threads. This is caused by Java memory
model.

To avoid this, shutdownInProgress should be declared as volatile
variable. Then all threads can read/write value to it synchronously.

As a result, brute force related code and synchronized object can be
discarded.

For keeping secure, setter for this flag is changed to no parameters.
Remove connecting flag

Now "connecting" has been used to determine whether disconnect ssh
connection. But it is not needed by devising shutdown logic.
Refactor ssh connection loop
fix notification point for connection event

Now connection established and connection down are notified to handler at
the below timing.

* ssh connection established / down
* gerrit stream-events established / down

These established/down events are notified to handler without connecton
type. It should be separated.

But now handler is mainly for stream events, so ones for ssh connection
are not needed.

So this patch stops notification for ssh connection.

In the future, it is better to implement notification for ssh connection
as new interface if needed.
Add interface to check connection status
Merge pull request #66 from rinrinne/watchdog-npe

Fix NPE for StreamWatchdog
Merge pull request #67 from rinrinne/connection-changes

Fixes for GerritConnection
Revert "Merge pull request #67 from rinrinne/connection-changes"

This reverts commit 8b43697d4db690de45cf153a0ebf5ede4fab4bed, reversing
changes made to 028eb17efe1e456a2dd4316a4cb74385745ea302.
Fixing a test regression
Merge branches 'master' and 'gitMaster'