Test server

A test NATS server for testing the NATS rust client and applications using it. Allows injection of bugsand useful for testing a number of things.

Example usage

```rust

[test]

fn testusenats() { let nats = NatsTestServer::build().spawn();

let mycomponent1 = component(nats.address()) let mycomponent2 = component(nats.address())

// test component behaviour

let nats = nats.restart().spawn();

// test behaviour after restart } // server is stopped on drop

[test]

fn testusebuggy_nats() { let nats = NatsTestServer::build().bugginess(400).spawn(); // a 1/400 chance of restarting on any given message

// bugginess test } ```

Limitations

The test server currently expects being used to test a single connection - so with multiple connections you will get some unexpected results: * subscriptions of one client will be seen by all the others * hop_ports doesn't make any sense for multiple clients