  @Test(expected=OptionAssignmentException.class)
  public void testCreateEndpointWithError() throws IOException {

    @SuppressWarnings("unchecked")
    final XEndpointListener<UndertowEndpoint> listener = mock(XEndpointListener.class);
    final UndertowEndpointManager mgr = new UndertowEndpointManager(null, 0, new DerivedEndpointConfig(), listener);
    final WebSocketChannel channel = Mockito.mock(WebSocketChannel.class);
    when(channel.setOption(any(), any())).thenThrow(new IOException("Boom"));
    mgr.createEndpoint(channel);
  }