@Test public void toSocketOptionLinger() { assertEquals(sockOptLingerDisabled, ChannelzProtoUtil.toSocketOptionLinger(-1)); assertEquals(sockOptlinger10s, ChannelzProtoUtil.toSocketOptionLinger(10)); }
static SocketOption toSocketOptionLinger(int lingerSeconds) { final SocketOptionLinger lingerOpt; if (lingerSeconds >= 0) { lingerOpt = SocketOptionLinger .newBuilder() .setActive(true) .setDuration(Durations.fromSeconds(lingerSeconds)) .build(); } else { lingerOpt = SocketOptionLinger.getDefaultInstance(); } return SocketOption .newBuilder() .setName(SO_LINGER) .setAdditional(Any.pack(lingerOpt)) .build(); }
ChannelzProtoUtil { static SocketOption toSocketOptionLinger(int lingerSeconds) { final SocketOptionLinger lingerOpt; if (lingerSeconds >= 0) { lingerOpt = SocketOptionLinger .newBuilder() .setActive(true) .setDuration(Durations.fromSeconds(lingerSeconds)) .build(); } else { lingerOpt = SocketOptionLinger.getDefaultInstance(); } return SocketOption .newBuilder() .setName(SO_LINGER) .setAdditional(Any.pack(lingerOpt)) .build(); } }
ChannelzProtoUtil { static SocketOption toSocketOptionLinger(int lingerSeconds) { final SocketOptionLinger lingerOpt; if (lingerSeconds >= 0) { lingerOpt = SocketOptionLinger .newBuilder() .setActive(true) .setDuration(Durations.fromSeconds(lingerSeconds)) .build(); } else { lingerOpt = SocketOptionLinger.getDefaultInstance(); } return SocketOption .newBuilder() .setName(SO_LINGER) .setAdditional(Any.pack(lingerOpt)) .build(); } private  ChannelzProtoUtil(); }
ChannelzProtoUtil { static SocketOption toSocketOptionLinger(int lingerSeconds) { final SocketOptionLinger lingerOpt; if (lingerSeconds >= 0) { lingerOpt = SocketOptionLinger .newBuilder() .setActive(true) .setDuration(Durations.fromSeconds(lingerSeconds)) .build(); } else { lingerOpt = SocketOptionLinger.getDefaultInstance(); } return SocketOption .newBuilder() .setName(SO_LINGER) .setAdditional(Any.pack(lingerOpt)) .build(); } private  ChannelzProtoUtil();  }
ChannelzProtoUtil { static SocketOption toSocketOptionLinger(int lingerSeconds) { final SocketOptionLinger lingerOpt; if (lingerSeconds >= 0) { lingerOpt = SocketOptionLinger .newBuilder() .setActive(true) .setDuration(Durations.fromSeconds(lingerSeconds)) .build(); } else { lingerOpt = SocketOptionLinger.getDefaultInstance(); } return SocketOption .newBuilder() .setName(SO_LINGER) .setAdditional(Any.pack(lingerOpt)) .build(); } private  ChannelzProtoUtil();  static final String SO_LINGER; static final String SO_TIMEOUT; static final String TCP_INFO; }