### Question:
Utils { static InternalChannelz.SocketOptions getSocketOptions(Socket socket) { InternalChannelz.SocketOptions.Builder builder = new InternalChannelz.SocketOptions.Builder(); try { builder.setSocketOptionLingerSeconds(socket.getSoLinger()); } catch (SocketException e) { log.log(Level.SEVERE, "Exception caught while reading socket option", e); builder.addOption("SO_LINGER", "channelz_internal_error"); } try { builder.setSocketOptionTimeoutMillis(socket.getSoTimeout()); } catch (Exception e) { log.log(Level.SEVERE, "Exception caught while reading socket option", e); builder.addOption("SO_TIMEOUT", "channelz_internal_error"); } try { builder.addOption("TCP_NODELAY", socket.getTcpNoDelay()); } catch (SocketException e) { log.log(Level.SEVERE, "Exception caught while reading socket option", e); builder.addOption("TCP_NODELAY", "channelz_internal_error"); } try { builder.addOption("SO_REUSEADDR", socket.getReuseAddress()); } catch (SocketException e) { log.log(Level.SEVERE, "Exception caught while reading socket option", e); builder.addOption("SO_REUSEADDR", "channelz_internal_error"); } try { builder.addOption("SO_SNDBUF", socket.getSendBufferSize()); } catch (SocketException e) { log.log(Level.SEVERE, "Exception caught while reading socket option", e); builder.addOption("SO_SNDBUF", "channelz_internal_error"); } try { builder.addOption("SO_RECVBUF", socket.getReceiveBufferSize()); } catch (SocketException e) { log.log(Level.SEVERE, "Exception caught while reading socket option", e); builder.addOption("SO_RECVBUF", "channelz_internal_error"); } try { builder.addOption("SO_KEEPALIVE", socket.getKeepAlive()); } catch (SocketException e) { log.log(Level.SEVERE, "Exception caught while reading socket option", e); builder.addOption("SO_KEEPALIVE", "channelz_internal_error"); } try { builder.addOption("SO_OOBINLINE", socket.getOOBInline()); } catch (SocketException e) { log.log(Level.SEVERE, "Exception caught while reading socket option", e); builder.addOption("SO_OOBINLINE", "channelz_internal_error"); } try { builder.addOption("IP_TOS", socket.getTrafficClass()); } catch (SocketException e) { log.log(Level.SEVERE, "Exception caught while reading socket option", e); builder.addOption("IP_TOS", "channelz_internal_error"); } return builder.build(); } private  Utils(); static Metadata convertHeaders(List<Header> http2Headers); static Metadata convertTrailers(List<Header> http2Headers);  }### Answer:
@Test public void getSocketOptions() throws Exception { Socket socket = new Socket(); socket.setSoLinger(true, 2); socket.setSoTimeout(3); socket.setTcpNoDelay(true); socket.setReuseAddress(true); socket.setReceiveBufferSize(4000); socket.setSendBufferSize(5000); socket.setKeepAlive(true); socket.setOOBInline(true); socket.setTrafficClass(8); SocketOptions socketOptions = Utils.getSocketOptions(socket); assertEquals(2, (int) socketOptions.lingerSeconds); assertEquals(3, (int) socketOptions.soTimeoutMillis); assertEquals("true", socketOptions.others.get("TCP_NODELAY")); assertEquals("true", socketOptions.others.get("SO_REUSEADDR")); assertEquals("4000", socketOptions.others.get("SO_RECVBUF")); assertEquals("5000", socketOptions.others.get("SO_SNDBUF")); assertEquals("true", socketOptions.others.get("SO_KEEPALIVE")); assertEquals("true", socketOptions.others.get("SO_OOBINLINE")); assertEquals("8", socketOptions.others.get("IP_TOS")); }