@Test
public void listenerRegistration_rejectNotWhitelistedHttpMethods(TestContext testContext) {

    final List<String> badMethods = Collections.unmodifiableList(new ArrayList<String>() {{
        // Some valid HTTP methods gateleen not accepts.
        add("CONNECT");
        add("TRACE");
        // Some methods available in postman gateleen doesn't care about.
        add("COPY");
        add("LINK");
        add("UNLINK");
        add("PURGE");
        add("LOCK");
        add("UNLOCK");
        add("PROPFIND");
        add("VIEW");
        // Some random, hopefully invalid methods.
        add("FOO");
        add("BAR");
        add("ASDF");
        add("ASSRGHAWERTH");
    }});
    // Test every method.
    for (String method : badMethods) {
        // Mock a request using current method.
        final int[] statusCodePtr = new int[]{0};
        final String[] statusMessagePtr = new String[]{null};
        final HttpServerRequest request;
        {
            final Buffer requestBody = toBuffer(new JsonObject("{" +
                    "    \"methods\": [ \"" + method + "\" ]," +
                    "    \"destination\": \"/an/example/destination/\"" +
                    "}"
            ));
            request = createSimpleRequest(PUT, "/gateleen/example/_hooks/listeners/http/my-service/a-random-hook-8518ul4st8d6944r6k",
                    requestBody, statusCodePtr, statusMessagePtr
            );
        }
        // Trigger
        hookHandler.handle(request);
        { // Assert request got rejected.
            testContext.assertEquals(400, statusCodePtr[0]);
        }
    }
}