@Test public void testLogin() { TestBody.test(new HttpServerTestBody() { @Override protected void execute() throws Exception { List<String> headers = Arrays.asList( Constants.HEADER_REQUEST_TARGET, Constants.HEADER_DATE); setServlet(new AdminServlet(headers)); KeyPair keyPair = KeyTestUtil.getKeyPairFromProperties("b2048", "id_rsa"); DefaultKeychain provider = new DefaultKeychain(); provider.add(new SSHKey(KeyFormat.SSH_RSA, keyPair)); AsyncHttpClient client = new AsyncHttpClient(); Signer signer = new Signer(provider, getKeyId()); Boolean response = AsyncUtil.login( client, signer, client.prepareGet(getAbsoluteUrl(TEST_URL)).build(), DEFAULT_HANDLER ).get(); assertTrue("login should be successful", response); } } ); }
public static Future<Response> login(final AsyncHttpClient client, final Signer signer, final Request loginRequest) throws IOException { return login(client, signer, loginRequest, new AsyncCompletionHandler<Response>() { @Override public Response onCompleted(Response response) throws Exception { return response; } }); }
AsyncUtil { public static Future<Response> login(final AsyncHttpClient client, final Signer signer, final Request loginRequest) throws IOException { return login(client, signer, loginRequest, new AsyncCompletionHandler<Response>() { @Override public Response onCompleted(Response response) throws Exception { return response; } }); } }
AsyncUtil { public static Future<Response> login(final AsyncHttpClient client, final Signer signer, final Request loginRequest) throws IOException { return login(client, signer, loginRequest, new AsyncCompletionHandler<Response>() { @Override public Response onCompleted(Response response) throws Exception { return response; } }); } private  AsyncUtil(); }
AsyncUtil { public static Future<Response> login(final AsyncHttpClient client, final Signer signer, final Request loginRequest) throws IOException { return login(client, signer, loginRequest, new AsyncCompletionHandler<Response>() { @Override public Response onCompleted(Response response) throws Exception { return response; } }); } private  AsyncUtil(); static void enableAuth(final AsyncHttpClient client, final Signer signer); static void enableAuth(final AsyncHttpClient client, final Signer signer, final SignatureCalculator calcBefore); static Future<Response> login(final AsyncHttpClient client,
                                         final Signer signer,
                                         final Request loginRequest); static Future<T> login(final AsyncHttpClient client,
                                      final Signer signer,
                                      final Request loginRequest,
                                      AsyncCompletionHandler<T> responseHandler); static Future<T> login(final AsyncHttpClient client,
                             final Signer signer,
                             final Request loginRequest,
                             final AsyncCompletionHandler<T> responseHandler,
                             final SignatureCalculator calcBefore); static void calculateSignature(Signer signer, Request request, RequestBuilderBase<?> requestBuilder); }
AsyncUtil { public static Future<Response> login(final AsyncHttpClient client, final Signer signer, final Request loginRequest) throws IOException { return login(client, signer, loginRequest, new AsyncCompletionHandler<Response>() { @Override public Response onCompleted(Response response) throws Exception { return response; } }); } private  AsyncUtil(); static void enableAuth(final AsyncHttpClient client, final Signer signer); static void enableAuth(final AsyncHttpClient client, final Signer signer, final SignatureCalculator calcBefore); static Future<Response> login(final AsyncHttpClient client,
                                         final Signer signer,
                                         final Request loginRequest); static Future<T> login(final AsyncHttpClient client,
                                      final Signer signer,
                                      final Request loginRequest,
                                      AsyncCompletionHandler<T> responseHandler); static Future<T> login(final AsyncHttpClient client,
                             final Signer signer,
                             final Request loginRequest,
                             final AsyncCompletionHandler<T> responseHandler,
                             final SignatureCalculator calcBefore); static void calculateSignature(Signer signer, Request request, RequestBuilderBase<?> requestBuilder);  }