output: #fixed code
                                  @Test
      public void testTcpAppenderDeadlock() throws Exception {
  
          // @formatter:off
          final SocketAppender appender = SocketAppender.newBuilder()
                  .withHost("localhost")
                  .withPort(DYN_PORT)
                  .withReconnectDelayMillis(100)
                  .withName("test")
                  .withImmediateFail(false)
                  .build();
          // @formatter:on
          appender.start();
          // set appender on root and set level to debug
          root.addAppender(appender);
          root.setAdditive(false);
          root.setLevel(Level.DEBUG);
  
          final TCPSocketServer tcpSocketServer = new TCPSocketServer(DYN_PORT);
          try {
              tcpSocketServer.start();
  
              root.debug("This message is written because a deadlock never.");
  
              final LogEvent event = tcpSocketServer.getQueue().poll(3, TimeUnit.SECONDS);
              assertNotNull("No event retrieved", event);
          } finally {
              tcpSocketServer.shutdown();
          }
      }
input: #vulnerable code 
                                  @Test
      public void testTcpAppenderDeadlock() throws Exception {
  
          // @formatter:off
          final SocketAppender appender = SocketAppender.newBuilder()
                  .withHost("localhost")
                  .withPort(DYN_PORT)
                  .withReconnectDelayMillis(100)
                  .withName("test")
                  .withImmediateFail(false)
                  .build();
          // @formatter:on
          appender.start();
          // set appender on root and set level to debug
          root.addAppender(appender);
          root.setAdditive(false);
          root.setLevel(Level.DEBUG);
  
          new TCPSocketServer(DYN_PORT).start();
  
          root.debug("This message is written because a deadlock never.");
  
          final LogEvent event = list.poll(3, TimeUnit.SECONDS);
          assertNotNull("No event retrieved", event);
      } 
                              #location 19 
                              #vulnerability type RESOURCE_LEAK