@Override
public SpdyConnection getConnection(String host, int port) throws IOException {
SpdyConnectionAprSocket spdy = new SpdyConnectionAprSocket(ctx);
AprSocket ch = con.socket(host, port, ctx.tls);
spdy.setSocket(ch);
ch.connect();
ch.setHandler(new SpdySocketHandler(spdy));
// need to consume the input to receive more read events
int rc = spdy.processInput();
if (rc == SpdyConnection.CLOSE) {
ch.close();
throw new IOException("Error connecting");
}
return spdy;
}