@Test
    public void shouldFailWithNoCredentials() {
        endpointProperties.remove(BasicAuthOptions.BASIC_USERNAME);
        endpointProperties.remove(BasicAuthOptions.BASIC_PASSWORD);
        endpointProperties.put(BasicAuthOptions.BASIC_REQUIRE_SSL, "false");
        api.setEndpointProperties(endpointProperties);
        api.setEndpoint("http://localhost:8008/echo");

        HttpConnectorFactory factory = new HttpConnectorFactory(globalConfig);
        IApiConnector connector = factory.createConnector(request, api, RequiredAuthType.BASIC, false, new ConnectorConfigImpl());
        IApiConnection connection = connector.connect(request,
                new IAsyncResultHandler<IApiConnectionResponse>() {
                    @Override
                    public void handle(IAsyncResult<IApiConnectionResponse> result) {
                        Assert.assertTrue("Expected a successful connection response.", result.isSuccess());
                        IApiConnectionResponse scr = result.getResult();
                        Assert.assertEquals("Expected a 401 response from the echo server (invalid creds).", 401, scr.getHead().getCode());
                    }
                });

        if (connection.isConnected()) {
            connection.end();
        }
    }
Should fail because no credentials were provided.
gateway/platforms/servlet/src/test/java/io/apiman/gateway/platforms/servlet/auth/basic/BasicAuthTest.java