class GetCookieFromRequestRule implements IResolveDependencyStrategy {

    @Override
    public <T> T resolve(final Object... args) {
        String cookieString = ((FullHttpRequest) args[0]).headers().get(HttpHeaders.Names.COOKIE);

        if (cookieString == null) {
            return null;
        }

        String[] cookie = Stream.of(cookieString.split(";"))
                .map(x -> x.split("="))
                .filter(x -> x[0].trim().equals(((String) args[1])))
                .findFirst().orElse(null);

        if (cookie == null || cookie.length == 1) {
            return null;
        }

        return (T) cookie[1];
    }

}