/** Create a client {@link Transceiver} connecting to the provided URI. */ public static Transceiver createTransceiver(URI uri) throws IOException { if ("http".equals(uri.getScheme())) return new HttpTransceiver(uri.toURL()); else if ("avro".equals(uri.getScheme())) return new SaslSocketTransceiver (new InetSocketAddress(uri.getHost(), uri.getPort())); else throw new IOException("unknown uri scheme: "+uri); }
@Override public Transceiver createTransceiver() throws Exception{ return new HttpTransceiver(new URL("https://localhost:"+server.getPort()+"/")); }
@Override public Transceiver createTransceiver() throws Exception{ return new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/")); }
@BeforeClass public static void initializeProxy() throws Exception { HttpTransceiver client = new HttpTransceiver(new URL("http://localhost")); SpecificRequestor requestor = new SpecificRequestor(SampleSpecificProtocol.class, client); proxy = SpecificRequestor.getClient(SampleSpecificProtocol.class, requestor); }
this.clientTransceiver =new HttpTransceiver(new URL("http://127.0.0.1:"+clientPort)); this.outputClient = SpecificRequestor.getClient(OutputProtocol.class, clientTransceiver); break;
@Test(expected=SocketTimeoutException.class) public void testTimeout() throws Throwable { ServerSocket s = new ServerSocket(0); HttpTransceiver client = new HttpTransceiver(new URL("http://127.0.0.1:"+s.getLocalPort()+"/")); client.setTimeout(100); Simple proxy = SpecificRequestor.getClient(Simple.class, client); try { proxy.hello("foo"); } catch (AvroRemoteException e) { throw e.getCause(); } finally { s.close(); } }
break; case HTTP: this.clientTransceiver =new HttpTransceiver(new URL("http://127.0.0.1:"+outputService.inputPort())); break; default:
@Test(expected = Exception.class) public void testConnectionRefusedOneWay() throws IOException { Transceiver client = new HttpTransceiver(new URL("http://localhost:4444")); SpecificRequestor req = new SpecificRequestor(Simple.class, client); addRpcPlugins(req); Simple proxy = SpecificRequestor.getClient(Simple.class, (SpecificRequestor)req); proxy.ack(); }
/** Sends RPCs and returns nanos elapsed. */ private static long sendRpcs(boolean withPlugin) throws IOException { HttpServer server = createServer(withPlugin); Transceiver t = new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/")); GenericRequestor requestor = new GenericRequestor(NULL_PROTOCOL, t); long now = System.nanoTime(); for (int i = 0; i < COUNT; ++i) { requestor.request("null", null); } long elapsed = System.nanoTime() - now; t.close(); server.close(); return elapsed; }
HttpTransceiver trans = new HttpTransceiver( new URL("http://localhost:" + Integer.parseInt(args[0]))); GenericRequestor req = new GenericRequestor(protocol, trans);
@Before public void startServer() throws Exception { if (server != null) return; server = new HttpServer(new SpecificResponder(BulkData.class, new BulkDataImpl()), 0); server.start(); client = new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/")); proxy = SpecificRequestor.getClient(BulkData.class, client); }
@Override public Transceiver newTransceiver() { return new HttpTransceiver(_url); }
/** Create a client {@link Transceiver} connecting to the provided URI. */ public static Transceiver createTransceiver(URI uri) throws IOException { if ("http".equals(uri.getScheme())) return new HttpTransceiver(uri.toURL()); else if ("avro".equals(uri.getScheme())) return new SaslSocketTransceiver (new InetSocketAddress(uri.getHost(), uri.getPort())); else throw new IOException("unknown uri scheme: "+uri); }
private GenericRequestor makeClient(Protocol protocol, URI uri) throws IOException { HttpTransceiver transceiver = new HttpTransceiver(uri.toURL()); GenericRequestor requestor = new GenericRequestor(protocol, transceiver); return requestor; } }
private GenericRequestor makeClient(Protocol protocol, URI uri) throws IOException { HttpTransceiver transceiver = new HttpTransceiver(uri.toURL()); GenericRequestor requestor = new GenericRequestor(protocol, transceiver); return requestor; } }
public AvroRpcWorkflowManagerClient(URL url){ workflowManagerUrl = url; try { client = new HttpTransceiver(url); proxy = SpecificRequestor.getClient(org.apache.oodt.cas.workflow.struct.avrotypes.WorkflowManager.class, client); } catch (IOException e) { logger.error("Error occurred when creating client for: {}", url, e); } logger.info("Client created successfully for workflow manager URL: {}", url); }
protected List<Span> collectAllSpans(List<URL> hosts) { List<Span> out = new ArrayList<Span>(); for (URL url: hosts) { HttpTransceiver trans = new HttpTransceiver(url); try { AvroTrace client = (AvroTrace) SpecificRequestor.getClient(AvroTrace.class, trans); for (Span s: client.getAllSpans()) { out.add(s); } } catch (IOException e) { continue; } } return out; }
protected List<Span> collectRangedSpans(List<URL> hosts, long start, long end) { List<Span> out = new ArrayList<Span>(); for (URL url: hosts) { HttpTransceiver trans = new HttpTransceiver(url); try { AvroTrace client = (AvroTrace) SpecificRequestor.getClient(AvroTrace.class, trans); for (Span s: client.getSpansInRange(start, end)) { out.add(s); } } catch (IOException e) { continue; } } return out; }
HttpTransceiver atrans = new HttpTransceiver(new URL("http://localhost:" + server.getPort() + "/test_a/")); HttpTransceiver btrans = new HttpTransceiver(new URL("http://localhost:" + server.getPort() + "/test_b/"));
break; case HTTP: this.clientTransceiver =new HttpTransceiver(new URL("http://127.0.0.1:"+outputService.inputPort())); break; default: