/** * Set the {@literal SETTINGS_INITIAL_WINDOW_SIZE} HTTP/2 setting * * @param initialWindowSize the new value * @return a reference to this, so the API can be used fluently */ public Http2Settings setInitialWindowSize(int initialWindowSize) { Arguments.require(initialWindowSize >= Http2CodecUtil.MIN_INITIAL_WINDOW_SIZE, "initialWindowSize must be >= " + Http2CodecUtil.MIN_INITIAL_WINDOW_SIZE); this.initialWindowSize = initialWindowSize; return this; }
public SocketAddressImpl(int port, String host) { Objects.requireNonNull(host, "no null host accepted"); Arguments.require(!host.isEmpty(), "no empty host accepted"); Arguments.requireInRange(port, 0, 65535, "port p must be in range 0 <= p <= 65535"); this.port = port; this.hostAddress = host; this.path = null; }
/** * Set the value of traffic class * * @param trafficClass the value of traffic class * @return a reference to this, so the API can be used fluently */ public NetworkOptions setTrafficClass(int trafficClass) { Arguments.requireInRange(trafficClass, DEFAULT_TRAFFIC_CLASS, 255, "trafficClass tc must be 0 <= tc <= 255"); this.trafficClass = trafficClass; return this; }
@Override public WriteStream<Buffer> sender(int port, String host) { Arguments.requireInRange(port, 0, 65535, "port p must be in range 0 <= p <= 65535"); Objects.requireNonNull(host, "no null host accepted"); return new PacketWriteStreamImpl(this, port, host); }
/** * set to {@code initialBufferSizeHttpDecoder} the initial buffer of the HttpDecoder. * * @param decoderInitialBufferSize the initial buffer size * @return a reference to this, so the API can be used fluently */ public HttpClientOptions setDecoderInitialBufferSize(int decoderInitialBufferSize) { Arguments.require(decoderInitialBufferSize > 0, "initialBufferSizeHttpDecoder must be > 0"); this.decoderInitialBufferSize = decoderInitialBufferSize; return this; }
public SocketAddressImpl(int port, String host) { Objects.requireNonNull(host, "no null host accepted"); Arguments.require(!host.isEmpty(), "no empty host accepted"); Arguments.requireInRange(port, 0, 65535, "port p must be in range 0 <= p <= 65535"); this.port = port; this.hostAddress = host; this.path = null; }
/** * Set the value of traffic class * * @param trafficClass the value of traffic class * @return a reference to this, so the API can be used fluently */ public NetworkOptions setTrafficClass(int trafficClass) { Arguments.requireInRange(trafficClass, DEFAULT_TRAFFIC_CLASS, 255, "trafficClass tc must be 0 <= tc <= 255"); this.trafficClass = trafficClass; return this; }
/** * Set the send timeout. * * @param timeout the timeout value, in ms. * @return a reference to this, so the API can be used fluently */ public DeliveryOptions setSendTimeout(long timeout) { Arguments.require(timeout >= 1, "sendTimeout must be >= 1"); this.timeout = timeout; return this; }
@Override public WriteStream<Buffer> sender(int port, String host) { Arguments.requireInRange(port, 0, 65535, "port p must be in range 0 <= p <= 65535"); Objects.requireNonNull(host, "no null host accepted"); return new PacketWriteStreamImpl(this, port, host); }
/** * Flip the parser into fixed size mode, where the record size is specified by {@code size} in bytes. * <p> * This method can be called multiple times with different values of size while data is being parsed. * * @param size the new record size */ public void fixedSizeMode(int size) { Arguments.require(size > 0, "Size must be > 0"); delimited = false; recordSize = size; }
/** * Set the TCP send buffer size * * @param sendBufferSize the buffers size, in bytes * @return a reference to this, so the API can be used fluently */ public NetworkOptions setSendBufferSize(int sendBufferSize) { Arguments.require(sendBufferSize > 0 || sendBufferSize == DEFAULT_SEND_BUFFER_SIZE, "sendBufferSize must be > 0"); this.sendBufferSize = sendBufferSize; return this; }
/** * Set the initial buffer size for the HTTP decoder * @param decoderInitialBufferSize the initial size * @return a reference to this, so the API can be used fluently */ public HttpServerOptions setDecoderInitialBufferSize(int decoderInitialBufferSize) { Arguments.require(decoderInitialBufferSize > 0, "initialBufferSizeHttpDecoder must be > 0"); this.decoderInitialBufferSize = decoderInitialBufferSize; return this; }
/** * Set the multicast ttl value * * @param multicastTimeToLive the multicast ttl value * @return a reference to this, so the API can be used fluently */ public DatagramSocketOptions setMulticastTimeToLive(int multicastTimeToLive) { Arguments.require(multicastTimeToLive >= 0, "multicastTimeToLive must be >= 0"); this.multicastTimeToLive = multicastTimeToLive; return this; }
/** * Set the TCP receive buffer size * * @param receiveBufferSize the buffers size, in bytes * @return a reference to this, so the API can be used fluently */ public NetworkOptions setReceiveBufferSize(int receiveBufferSize) { Arguments.require(receiveBufferSize > 0 || receiveBufferSize == DEFAULT_RECEIVE_BUFFER_SIZE, "receiveBufferSize must be > 0"); this.receiveBufferSize = receiveBufferSize; return this; }
/** * Set the {@literal SETTINGS_MAX_HEADER_LIST_SIZE} HTTP/2 setting * * @param maxHeaderListSize the new value * @return a reference to this, so the API can be used fluently */ public Http2Settings setMaxHeaderListSize(long maxHeaderListSize) { Arguments.require(maxHeaderListSize >= 0, "maxHeaderListSize must be >= 0"); Arguments.require(maxHeaderListSize >= Http2CodecUtil.MIN_HEADER_LIST_SIZE, "maxHeaderListSize must be >= " + Http2CodecUtil.MIN_HEADER_LIST_SIZE); this.maxHeaderListSize = maxHeaderListSize; return this; }
/** * Set the maximum allowed size for a record when using the delimited mode. * The delimiter itself does not count for the record size. * <p> * If a record is longer than specified, an {@link IllegalStateException} will be thrown. * * @param size the maximum record size * @return a reference to this, so the API can be used fluently */ public RecordParser maxRecordSize(int size) { Arguments.require(size > 0, "Size must be > 0"); maxRecordSize = size; return this; }
/** * Set {@literal SETTINGS_HEADER_TABLE_SIZE} HTTP/2 setting. * * @param headerTableSize the new value * @return a reference to this, so the API can be used fluently */ public Http2Settings setHeaderTableSize(long headerTableSize) { Arguments.require(headerTableSize >= Http2CodecUtil.MIN_HEADER_TABLE_SIZE, "headerTableSize must be >= " + Http2CodecUtil.MIN_HEADER_TABLE_SIZE); Arguments.require(headerTableSize <= Http2CodecUtil.MAX_HEADER_TABLE_SIZE, "headerTableSize must be <= " + Http2CodecUtil.MAX_HEADER_TABLE_SIZE); this.headerTableSize = headerTableSize; return this; }
/** * Set the {@literal SETTINGS_MAX_CONCURRENT_STREAMS} HTTP/2 setting * * @param maxConcurrentStreams the new value * @return a reference to this, so the API can be used fluently */ public Http2Settings setMaxConcurrentStreams(long maxConcurrentStreams) { Arguments.require(maxConcurrentStreams >= Http2CodecUtil.MIN_CONCURRENT_STREAMS, "maxConcurrentStreams must be >= " + Http2CodecUtil.MIN_CONCURRENT_STREAMS); Arguments.require(maxConcurrentStreams <= Http2CodecUtil.MAX_CONCURRENT_STREAMS, "maxConcurrentStreams must be < " + Http2CodecUtil.MAX_CONCURRENT_STREAMS); this.maxConcurrentStreams = maxConcurrentStreams; return this; }
/** * Set the {@literal SETTINGS_MAX_FRAME_SIZE} HTTP/2 setting * * @param maxFrameSize the new value * @return a reference to this, so the API can be used fluently */ public Http2Settings setMaxFrameSize(int maxFrameSize) { Arguments.require(maxFrameSize >= Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND, "maxFrameSize must be >= " + Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND); Arguments.require(maxFrameSize <= Http2CodecUtil.MAX_FRAME_SIZE_UPPER_BOUND, "maxFrameSize must be <= " + Http2CodecUtil.MAX_FRAME_SIZE_UPPER_BOUND); this.maxFrameSize = maxFrameSize; return this; }
public InboundBuffer(Context context, long highWaterMark) { Objects.requireNonNull(context, "context must not be null"); Arguments.require(highWaterMark >= 0, "highWaterMark " + highWaterMark + " >= 0"); this.context = context; this.highWaterMark = highWaterMark; this.demand = Long.MAX_VALUE; this.pending = new ArrayDeque<>(); }