Example usage for io.netty.handler.codec.http HttpRequest getUri

List of usage examples for io.netty.handler.codec.http HttpRequest getUri

Introduction

In this page you can find the example usage for io.netty.handler.codec.http HttpRequest getUri.

Prototype

@Deprecated
String getUri();

Source Link

Usage

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void testTimestampTooLate() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString((System.currentTimeMillis() / 1000) + 9001) + "\", "
            + "oauth_signature_method=\"HMAC-SHA1\", " + "oauth_version=\"1.0\", "
            + "oauth_token=\"oauth_token\", " + "oauth_signature=\"CBTk%2FvzxEqqr0AvhnVgdWNHuKfw%3D\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void testTimestampTooEarly() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString((System.currentTimeMillis() / 1000) - 9001) + "\", "
            + "oauth_signature_method=\"HMAC-SHA1\", " + "oauth_version=\"1.0\", "
            + "oauth_token=\"oauth_token\", " + "oauth_signature=\"CBTk%2FvzxEqqr0AvhnVgdWNHuKfw%3D\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void missingOAuthSignatureMethod() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString(System.currentTimeMillis() / 1000) + "\", " + "oauth_version=\"1.0\", "
            + "oauth_token=\"oauth_token\", " + "oauth_signature=\"CBTk%2FvzxEqqr0AvhnVgdWNHuKfw%3D\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void invalidOAuthSignatureMethod() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString(System.currentTimeMillis() / 1000) + "\", " + "oauth_signature_method=\"MD5\", "
            + "oauth_token=\"oauth_token\", " + "oauth_version=\"1.0\", "
            + "oauth_signature=\"CBTk%2FvzxEqqr0AvhnVgdWNHuKfw%3D\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void missingOAuthVersion() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString(System.currentTimeMillis() / 1000) + "\", "
            + "oauth_signature_method=\"HMAC-SHA1\", " + "oauth_token=\"oauth_token\", "
            + "oauth_signature=\"CBTk%2FvzxEqqr0AvhnVgdWNHuKfw%3D\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void invalidOAuthVersion() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString(System.currentTimeMillis() / 1000) + "\", "
            + "oauth_signature_method=\"HMAC-SHA1\", " + "oauth_token=\"oauth_token\", "
            + "oauth_version=\"2.0\", " + "oauth_signature=\"CBTk%2FvzxEqqr0AvhnVgdWNHuKfw%3D\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void missingOAuthToken() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString(System.currentTimeMillis() / 1000) + "\", "
            + "oauth_signature_method=\"HMAC-SHA1\", " + "oauth_version=\"1.0\", "
            + "oauth_signature=\"CBTk%2FvzxEqqr0AvhnVgdWNHuKfw%3D\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void missingOAuthSignature() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString(System.currentTimeMillis() / 1000) + "\", "
            + "oauth_signature_method=\"HMAC-SHA1\", " + "oauth_version=\"1.0\", "
            + "oauth_token=\"oauth_token\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void invalidParameter() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString(System.currentTimeMillis() / 1000) + "\", "
            + "oauth_signature_method=\"HMAC-SHA1\", " + "oauth_version=\"1.0\", "
            + "oauth_token=\"oauth_token\"" + "oauth_signature=\"CBTk%2FvzxEqqr0AvhnVgdWNHuKfw%3D\""
            + "i_am_invalid=\"I'm totally fake\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}

From source file:net.mms_projects.copy_it.api.oauth.HeaderVerifierTest.java

License:Open Source License

@Test(expected = OAuthException.class, timeout = 750)
public void tooLongNonce() throws OAuthException, URISyntaxException {
    String header = "OAuth realm=\"\", "
            + "oauth_consumer_key=\"401a131e03357df2a563fba48f98749448ed63d37e007f7353608cf81fa70a2d\", "
            + "oauth_nonce=\"" + Utils.generateNonce() + Utils.generateNonce() + "\", " + "oauth_timestamp=\""
            + Long.toString(System.currentTimeMillis() / 1000) + "\", "
            + "oauth_signature_method=\"HMAC-SHA1\", " + "oauth_version=\"1.0\", "
            + "oauth_token=\"oauth_token\"" + "oauth_signature=\"CBTk%2FvzxEqqr0AvhnVgdWNHuKfw%3D\""
            + "i_am_invalid=\"I'm totally fake\"";
    HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
            "http://127.0.0.1:8080/");
    request.headers().add(AUTHORIZATION, header);
    new HeaderVerifier(request, new URI(request.getUri()));
}