Just declare the connection as IHubConnection so you dont have to cast, aka up top:

```C#
IHubConnection connection = new HubConnection("http://foo");
```