SdkSSLMetricsSocket extends DelegateSSLSocket { public void setMetrics(AWSRequestMetrics metrics) throws IOException { getInputStream(); metricsIS.setMetrics(metrics); } SdkSSLMetricsSocket(SSLSocket sock); void setMetrics(AWSRequestMetrics metrics); @Override InputStream getInputStream();  }
@Test public void testSetMetrics() throws IOException { SSLSocket sock = mock(SSLSocket.class); InputStream inputStream = mock(InputStream.class); when(sock.getInputStream()).thenReturn(inputStream); SdkSSLMetricsSocket sdkSSLMetricsSocket = new SdkSSLMetricsSocket(sock); sdkSSLMetricsSocket.setMetrics(new AWSRequestMetrics()); Assert.assertThat(sdkSSLMetricsSocket.getMetricsInputStream(), not(nullValue())); }