class ServerConnectionFactory {

  ServerConnection makeServerConnection(final Socket socket, final InternalCache cache,
      final CachedRegionHelper cachedRegionHelper, final CacheServerStats stats,
      final int hsTimeout, final int socketBufferSize, final String communicationModeStr,
      final byte communicationMode, final Acceptor acceptor, final SecurityService securityService)
      throws IOException {
    if (ProtobufClientServerProtocol.getModeNumber() == communicationMode) {
      if (!Boolean.getBoolean("geode.feature-protobuf-protocol")) {
        throw new IOException("Server received unknown communication mode: " + communicationMode);
      }
      try {
        return createProtobufServerConnection(socket, cache, cachedRegionHelper, stats, hsTimeout,
            socketBufferSize, communicationModeStr, communicationMode, acceptor, securityService);
      } catch (ServiceLoadingFailureException ex) {
        throw new IOException("Could not load protobuf client protocol", ex);
      } catch (ServiceVersionNotFoundException ex) {
        throw new IOException("No service matching provided version byte", ex);
      }
    }
    return new OriginalServerConnection(socket, cache, cachedRegionHelper, stats, hsTimeout,
        socketBufferSize, communicationModeStr, communicationMode, acceptor, securityService);
  }

  public  ServerConnectionFactory();

}