final Connection c = ctx.getConnection();
final HttpContext httpCtx;
if (!Utils.isSpdyConnection(c)) {
httpCtx = HttpContext.newInstance(c, c, c, requestPacketLocal);
} else {
SpdySession session = SpdySession.get(c);
final Lock lock = session.getNewClientStreamLock();
try {
lock.lock();
SpdyStream stream = session.openStream(requestPacketLocal, session.getNextLocalStreamId(), 0, 0, 0, false,
!requestPacketLocal.isExpectContent());
httpCtx = HttpContext.newInstance(stream, stream, stream, requestPacketLocal);
} finally {
lock.unlock();
}