@Test public void toSocketOptionsList() { assertThat( ChannelzProtoUtil.toSocketOptionsList( new InternalChannelz.SocketOptions.Builder().build())) .isEmpty(); assertThat( ChannelzProtoUtil.toSocketOptionsList( new InternalChannelz.SocketOptions.Builder().setSocketOptionLingerSeconds(10).build())) .containsExactly(sockOptlinger10s); assertThat( ChannelzProtoUtil.toSocketOptionsList( new InternalChannelz.SocketOptions.Builder().setSocketOptionTimeoutMillis(200).build())) .containsExactly(sockOptTimeout200ms); assertThat( ChannelzProtoUtil.toSocketOptionsList( new InternalChannelz.SocketOptions .Builder() .addOption("SO_MADE_UP_OPTION", "some-made-up-value") .build())) .containsExactly(sockOptAdditional); SocketOption otherOption = SocketOption .newBuilder() .setName("SO_MADE_UP_OPTION2") .setValue("some-made-up-value2") .build(); assertThat( ChannelzProtoUtil.toSocketOptionsList( new InternalChannelz.SocketOptions.Builder() .addOption("SO_MADE_UP_OPTION", "some-made-up-value") .addOption("SO_MADE_UP_OPTION2", "some-made-up-value2") .build())) .containsExactly(sockOptAdditional, otherOption); }
static List<SocketOption> toSocketOptionsList(InternalChannelz.SocketOptions options) { Preconditions.checkNotNull(options); List<SocketOption> ret = new ArrayList<>(); if (options.lingerSeconds != null) { ret.add(toSocketOptionLinger(options.lingerSeconds)); } if (options.soTimeoutMillis != null) { ret.add(toSocketOptionTimeout(SO_TIMEOUT, options.soTimeoutMillis)); } if (options.tcpInfo != null) { ret.add(toSocketOptionTcpInfo(options.tcpInfo)); } for (Entry<String, String> entry : options.others.entrySet()) { ret.add(toSocketOptionAdditional(entry.getKey(), entry.getValue())); } return ret; }
ChannelzProtoUtil { static List<SocketOption> toSocketOptionsList(InternalChannelz.SocketOptions options) { Preconditions.checkNotNull(options); List<SocketOption> ret = new ArrayList<>(); if (options.lingerSeconds != null) { ret.add(toSocketOptionLinger(options.lingerSeconds)); } if (options.soTimeoutMillis != null) { ret.add(toSocketOptionTimeout(SO_TIMEOUT, options.soTimeoutMillis)); } if (options.tcpInfo != null) { ret.add(toSocketOptionTcpInfo(options.tcpInfo)); } for (Entry<String, String> entry : options.others.entrySet()) { ret.add(toSocketOptionAdditional(entry.getKey(), entry.getValue())); } return ret; } }
ChannelzProtoUtil { static List<SocketOption> toSocketOptionsList(InternalChannelz.SocketOptions options) { Preconditions.checkNotNull(options); List<SocketOption> ret = new ArrayList<>(); if (options.lingerSeconds != null) { ret.add(toSocketOptionLinger(options.lingerSeconds)); } if (options.soTimeoutMillis != null) { ret.add(toSocketOptionTimeout(SO_TIMEOUT, options.soTimeoutMillis)); } if (options.tcpInfo != null) { ret.add(toSocketOptionTcpInfo(options.tcpInfo)); } for (Entry<String, String> entry : options.others.entrySet()) { ret.add(toSocketOptionAdditional(entry.getKey(), entry.getValue())); } return ret; } private  ChannelzProtoUtil(); }
ChannelzProtoUtil { static List<SocketOption> toSocketOptionsList(InternalChannelz.SocketOptions options) { Preconditions.checkNotNull(options); List<SocketOption> ret = new ArrayList<>(); if (options.lingerSeconds != null) { ret.add(toSocketOptionLinger(options.lingerSeconds)); } if (options.soTimeoutMillis != null) { ret.add(toSocketOptionTimeout(SO_TIMEOUT, options.soTimeoutMillis)); } if (options.tcpInfo != null) { ret.add(toSocketOptionTcpInfo(options.tcpInfo)); } for (Entry<String, String> entry : options.others.entrySet()) { ret.add(toSocketOptionAdditional(entry.getKey(), entry.getValue())); } return ret; } private  ChannelzProtoUtil();  }
ChannelzProtoUtil { static List<SocketOption> toSocketOptionsList(InternalChannelz.SocketOptions options) { Preconditions.checkNotNull(options); List<SocketOption> ret = new ArrayList<>(); if (options.lingerSeconds != null) { ret.add(toSocketOptionLinger(options.lingerSeconds)); } if (options.soTimeoutMillis != null) { ret.add(toSocketOptionTimeout(SO_TIMEOUT, options.soTimeoutMillis)); } if (options.tcpInfo != null) { ret.add(toSocketOptionTcpInfo(options.tcpInfo)); } for (Entry<String, String> entry : options.others.entrySet()) { ret.add(toSocketOptionAdditional(entry.getKey(), entry.getValue())); } return ret; } private  ChannelzProtoUtil();  static final String SO_LINGER; static final String SO_TIMEOUT; static final String TCP_INFO; }