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

The following examples show how to use com.google.apphosting.api.ApiProxy#ApiConfig . 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: LogTest.java    From appengine-java-vm-runtime with Apache License 2.0 5 votes vote down vote up
public Future<byte[]> makeAsyncCall(
    Environment environment,
    String packageName,
    String methodName,
    byte[] request,
    ApiProxy.ApiConfig apiConfig) {
  return oldDelegate.makeAsyncCall(environment, packageName, methodName, request, apiConfig);
}
 
Example 2
Source File: TestDatagramSocketServlet.java    From appengine-java-vm-runtime with Apache License 2.0 5 votes vote down vote up
@Override
public Future<byte[]> makeAsyncCall(
    ApiProxy.Environment environment,
    String packageName,
    String methodName,
    byte[] request,
    ApiProxy.ApiConfig apiConfig) {
  if ("remote_socket".equals(packageName)) {
    final byte[] response = makeResponse(methodName, request);
    return new Future<byte[]>() {
      @Override
      public boolean cancel(boolean mayInterruptIfRunning) {
        return false;
      }

      @Override
      public boolean isCancelled() {
        return false;
      }

      @Override
      public boolean isDone() {
        return true;
      }

      @Override
      public byte[] get() throws InterruptedException, ExecutionException {
        return response;
      }

      @Override
      public byte[] get(long timeout, TimeUnit unit)
          throws InterruptedException, ExecutionException, TimeoutException {
        return response;
      }
    };
  }
  throw new UnsupportedOperationException();
}
 
Example 3
Source File: TestSocketServlet.java    From appengine-java-vm-runtime with Apache License 2.0 5 votes vote down vote up
@Override
public Future<byte[]> makeAsyncCall(
    ApiProxy.Environment environment,
    String packageName,
    String methodName,
    byte[] request,
    ApiProxy.ApiConfig apiConfig) {
  if ("remote_socket".equals(packageName)) {
    final byte[] response = makeResponse(methodName, request);
    return new Future<byte[]>() {
      @Override
      public boolean cancel(boolean mayInterruptIfRunning) {
        return false;
      }

      @Override
      public boolean isCancelled() {
        return false;
      }

      @Override
      public boolean isDone() {
        return true;
      }

      @Override
      public byte[] get() throws InterruptedException, ExecutionException {
        return response;
      }

      @Override
      public byte[] get(long timeout, TimeUnit unit)
          throws InterruptedException, ExecutionException, TimeoutException {
        return response;
      }
    };
  }
  throw new UnsupportedOperationException();
}
 
Example 4
Source File: TestInetAddressServlet.java    From appengine-java-vm-runtime with Apache License 2.0 5 votes vote down vote up
@Override
public Future<byte[]> makeAsyncCall(
    ApiProxy.Environment environment,
    String packageName,
    String methodName,
    byte[] request,
    ApiProxy.ApiConfig apiConfig) {
  if ("remote_socket".equals(packageName) && "Resolve".equals(methodName)) {
    return new Future<byte[]>() {
      @Override
      public boolean cancel(boolean mayInterruptIfRunning) {
        return false;
      }

      @Override
      public boolean isCancelled() {
        return false;
      }

      @Override
      public boolean isDone() {
        return true;
      }

      @Override
      public byte[] get() throws InterruptedException, ExecutionException {
        return RESOLVER_RESPONSE;
      }

      @Override
      public byte[] get(long timeout, TimeUnit unit)
          throws InterruptedException, ExecutionException, TimeoutException {
        return RESOLVER_RESPONSE;
      }
    };
  }
  throw new UnsupportedOperationException();
}
 
Example 5
Source File: SessionManagerTest.java    From appengine-java-vm-runtime with Apache License 2.0 5 votes vote down vote up
public Future<byte[]> makeAsyncCall(
    ApiProxy.Environment environment,
    String packageName,
    String methodName,
    byte[] request,
    ApiProxy.ApiConfig apiConfig) {
  if (packageName.equals("datastore_v3") && timeoutCount > 0) {
    timeoutCount--;
    throw new DatastoreTimeoutException("Timeout");
  }
  return delegate.makeAsyncCall(environment, packageName, methodName, request, apiConfig);
}