CancellableConnection () { return new CancellableConnection() { Transport myTransport; @Override protected void doTest() throws Exception { myTransport = new Transport(); getIssues("", 1, myTransport); } @Override public void cancel() { myTransport.cancel(); } }; }