Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-815 SocketAppenderBase should use a SocketFactory and allow subclasses to provide it
  3. LOGBACK-816

SimpleSocketServer should use a ServerSocketFactory and allow subclasses to provide it

    XMLWordPrintable

Details

    Description

      In SimpleSocketServer.run, the ServerSocket constructor is invoked directly to create a new server socket. This makes it difficult for a subclass to have any influence over the creation of server sockets (e.g. to use an SSL server socket).

      If SimpleSocketServer declared a method such as this:

      protected ServerSocketFactory getServerSocketFactory() {
      return ServerSocketFactory.getDefault()
      }

      and used it in the run() implementation...

      ...
      serverSocket = getServerSocketFactory().createSocket(port);
      ...

      then a subclass could override it with, for example, an appropriately configured SSLServerSocketFactory...

      public class MySSLSimpleSocketServer extends SimpleSocketServer {
      ...
      protected ServerSocketFactory getServerSocketFactory()

      { return mySslContext.getServerSocketFactory(); }

      ...
      }

      Attachments

        Activity

          People

            logback-dev Logback dev list
            ceharris Carl Harris
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: