@Override
  public void handle(final RoutingContext routingContext) {
    final HttpConnection httpConnection = routingContext.request().connection();
    if (!httpConnection.isSsl()) {
      throw new IllegalStateException("Should only have ssl connections");
    }
    final Principal peerPrincipal = getPeerPrincipal(httpConnection.sslSession());
    routingContext.setUser(new SystemUser(peerPrincipal));
    routingContext.next();
  }
@Test (expected = IllegalStateException.class)
  public void shouldNotSetUser_noSsl() {
    when(routingContext.request()).thenReturn(request);
    when(request.connection()).thenReturn(connection);
    when(connection.isSsl()).thenReturn(false);
    SystemAuthenticationHandler handler = new SystemAuthenticationHandler();
    handler.handle(routingContext);
    verify(routingContext, never()).setUser(any());
    verify(routingContext).next();
  }