Java Code Examples for com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver#stop()

The following examples show how to use com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver#stop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoginServiceUi.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void stopLocalServerReceiver(LocalServerReceiver codeReceiver) {
  try {
    codeReceiver.stop();
  } catch (IOException ex) {
    logger.log(Level.WARNING, "Failed to stop the local web server for login.", ex); //$NON-NLS-1$
  }
}
 
Example 2
Source File: LoginServiceUiTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testLoginSuccessPage() throws IOException {
  LocalServerReceiver server = LoginServiceUi.createLocalServerReceiver();
  try {
    String localServerUrl = server.getRedirectUri();
    String landingPageUrl = simulateLogin(localServerUrl + "?code=success-simulated");
    assertEquals("https://cloud.google.com/eclipse/auth_success", landingPageUrl);
  } finally {
    server.stop();
  }
}
 
Example 3
Source File: LoginServiceUiTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testLoginFailurePage() throws IOException {
  LocalServerReceiver server = LoginServiceUi.createLocalServerReceiver();
  try {
    String localServerUrl = server.getRedirectUri();
    String landingPageUrl = simulateLogin(localServerUrl + "?error=simulated");
    assertEquals("https://cloud.google.com/eclipse/auth_failure", landingPageUrl);
  } finally {
    server.stop();
  }
}