@Test
public void createConnectionReturnsConnectionFromService() {

    Connection connection = mock(Connection.class);
    when(service.createConnection(connection)).thenReturn(Observable.just(connection));
    TestSubscriber<Connection> ts = new TestSubscriber<>();
    network.createConnection(connection).subscribe(ts);
    assertThat(ts.getOnNextEvents(), hasItems(connection));
}