use of io.grpc.InternalChannelz.SocketOptions in project grpc-java by grpc.
the class UtilsTest method setAndValidateGeneric.
private static InternalChannelz.SocketOptions setAndValidateGeneric(Channel channel) {
channel.config().setOption(ChannelOption.SO_LINGER, 3);
// only applicable for OIO channels:
channel.config().setOption(ChannelOption.SO_TIMEOUT, 250);
// Test some arbitrarily chosen options with a non numeric values
channel.config().setOption(ChannelOption.SO_KEEPALIVE, true);
WriteBufferWaterMark writeBufWaterMark = new WriteBufferWaterMark(10, 20);
channel.config().setOption(ChannelOption.WRITE_BUFFER_WATER_MARK, writeBufWaterMark);
InternalChannelz.SocketOptions socketOptions = Utils.getSocketOptions(channel);
assertEquals(3, (int) socketOptions.lingerSeconds);
assertEquals("true", socketOptions.others.get("SO_KEEPALIVE"));
assertEquals(writeBufWaterMark.toString(), socketOptions.others.get(ChannelOption.WRITE_BUFFER_WATER_MARK.toString()));
return socketOptions;
}
Aggregations