Github user galen-pivotal commented on a diff in the pull request: https://github.com/apache/geode/pull/716#discussion_r134024644 --- Diff: geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/TcpServerFactory.java --- @@ -0,0 +1,39 @@ +package org.apache.geode.internal.cache.tier.sockets; + +import java.net.InetAddress; +import java.util.Properties; + +import org.apache.geode.distributed.internal.DistributionConfigImpl; +import org.apache.geode.distributed.internal.InternalLocator; +import org.apache.geode.distributed.internal.PoolStatHelper; +import org.apache.geode.distributed.internal.tcpserver.TcpHandler; +import org.apache.geode.distributed.internal.tcpserver.TcpServer; + +public class TcpServerFactory { + private ClientProtocolMessageHandler protocolHandler; + + public TcpServerFactory() { + initializeMessageHandler(); + } + + public TcpServer makeTcpServer(int port, InetAddress bind_address, Properties sslConfig, + DistributionConfigImpl cfg, TcpHandler handler, PoolStatHelper poolHelper, + ThreadGroup threadGroup, String threadName, InternalLocator internalLocator) { + + return new TcpServer(port, bind_address, sslConfig, cfg, handler, poolHelper, threadGroup, + threadName, internalLocator, protocolHandler); + } + + public synchronized ClientProtocolMessageHandler initializeMessageHandler() { + if (!Boolean.getBoolean("geode.feature-protobuf-protocol")) { + return null; --- End diff -- If we don't throw here, it will result in an NPE down the line when we try to receive a message from the null handler. I think it's better to throw here than return null -- see the similar `IOException` thrown by `ServerConnectionFactory`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---