Java Code Examples for com.google.apphosting.api.ApiProxy#Delegate

The following examples show how to use com.google.apphosting.api.ApiProxy#Delegate . 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: TestDatagramSocketServlet.java    From appengine-java-vm-runtime with Apache License 2.0 6 votes vote down vote up
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
  ApiProxy.Delegate oldDelegate = setUpMockDelegate();

  response.setContentType("text/plain");
  try {
    testOpenAndClose(response);

    testConnectWriteAndRead(response);
    testSocketOpt(response);
    testSetDatagramSocketImpl(response);
    testSocketImplConstructor(response);
  } catch (AssertionFailedException e) {
    return;
    //return the error response
  } finally {
    ApiProxy.setDelegate(oldDelegate);
  }
  response.getWriter().print("Success!");
}
 
Example 2
Source File: TestSocketServlet.java    From appengine-java-vm-runtime with Apache License 2.0 6 votes vote down vote up
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
  ApiProxy.Delegate oldDelegate = setUpMockDelegate();

  response.setContentType("text/plain");
  try {
    testConnectWriteAndRead(response);
    testTimedConnect(response);
    testSocketOpt(response);
    testSetSocketImpl(response);
    testShutDownAndClose(response);
    testProxyConstructor(response);
    testSocketImplConstructor(response);
  } catch (AssertionFailedException e) {
    return;
    //return the error response
  } finally {
    ApiProxy.setDelegate(oldDelegate);
  }
  response.getWriter().print("Success!");
}
 
Example 3
Source File: TestDatagramSocketServlet.java    From appengine-java-vm-runtime with Apache License 2.0 4 votes vote down vote up
/**
 * Set up a mock delegate to socket resolve calls.
 */
private ApiProxy.Delegate setUpMockDelegate() {
  ApiProxy.Delegate oldDelegate = ApiProxy.getDelegate();
  ApiProxy.setDelegate(new MockDelegate());
  return oldDelegate;
}
 
Example 4
Source File: TestSocketServlet.java    From appengine-java-vm-runtime with Apache License 2.0 4 votes vote down vote up
/**
 * Set up a mock delegate to handle resolve calls.
 */
private ApiProxy.Delegate setUpMockDelegate() {
  ApiProxy.Delegate oldDelegate = ApiProxy.getDelegate();
  ApiProxy.setDelegate(new MockDelegate());
  return oldDelegate;
}
 
Example 5
Source File: TestInetAddressServlet.java    From appengine-java-vm-runtime with Apache License 2.0 4 votes vote down vote up
/**
 * Set up a mock delegate to handle resolve calls.
 */
private ApiProxy.Delegate setUpMockDelegate() {
  ApiProxy.Delegate oldDelegate = ApiProxy.getDelegate();
  ApiProxy.setDelegate(new MockDelegate());
  return oldDelegate;
}
 
Example 6
Source File: UrlOverSocketsTestServlet.java    From appengine-java-vm-runtime with Apache License 2.0 4 votes vote down vote up
/**
 * Set up a mock delegate to handle resolve calls.
 */
private ApiProxy.Delegate setUpMockDelegate() {
  ApiProxy.Delegate oldDelegate = ApiProxy.getDelegate();
  ApiProxy.setDelegate(new UrlMockDelegate());
  return oldDelegate;
}