com.appenginefan.toolkit.common
Interface WebConnectionClient.Environment

All Known Implementing Classes:
HttpClientEnvironment
Enclosing class:
WebConnectionClient

public static interface WebConnectionClient.Environment

Abstraction of everything that depends on the runtime environment, like system clock, threading, or network. Easy to replace with mocks for unit tests.


Method Summary
 long currentTimeMillis()
          Gets the current time in milliseconds
 void execute(WebConnectionClient client)
          Controls the execution of the client's run-method in an independent thread.
 String fetch(String data)
          Performs an http request to the server
 void sleep(long millis)
          Holds the current thread for a certain amount of milliseconds
 

Method Detail

fetch

String fetch(String data)
Performs an http request to the server

Parameters:
data - the data to be transmitted
Returns:
the response payload, or null if the connection failed.

execute

void execute(WebConnectionClient client)
Controls the execution of the client's run-method in an independent thread. Similar to the Executor interface, just not for generic runnables, and it would also work in Java 1.3


sleep

void sleep(long millis)
           throws InterruptedException
Holds the current thread for a certain amount of milliseconds

Throws:
InterruptedException

currentTimeMillis

long currentTimeMillis()
Gets the current time in milliseconds