/** * Create instance but does not start handshake. * * @param myKey * @param input * @param output * * @throws IOException */ public BitrustedConnector(PrivateKey myKey, InputStream input, OutputStream output) throws IOException { this.myKey = myKey; connection = new Farcall(new BossConnector(input, output)); connection.asyncCommands(Executors.newSingleThreadExecutor()); }
@Test(timeout = 200) public void jsonConnector() throws Exception { StreamConnector sa = new StreamConnector(); StreamConnector sb = new StreamConnector(); JsonConnector connA = new JsonConnector(sa.getInputStream(), sb.getOutputStream()); JsonConnector connB = new JsonConnector(sb.getInputStream(), sa.getOutputStream()); Farcall a = new Farcall(connA); Farcall b = new Farcall(connB); basicTest(null, a, b); }
@Test(timeout = 200) public void bossConnector() throws Exception { StreamConnector sa = new StreamConnector(); StreamConnector sb = new StreamConnector(); BossConnector connA = new BossConnector(sa.getInputStream(), sb.getOutputStream()); BossConnector connB = new BossConnector(sb.getInputStream(), sa.getOutputStream()); Farcall a = new Farcall(connA); Farcall b = new Farcall(connB); basicTest(null, a, b); }