use of com.github.ambry.network.http2.Http2BlockingChannel in project ambry by linkedin.
the class ServerTestUtil method getBlockingChannelBasedOnPortType.
/**
* Returns BlockingChannel, SSLBlockingChannel or Http2BlockingChannel depending on whether the port type is PlainText,
* SSL or HTTP2 port for the given targetPort
* @param portType The type of port to connect to
* @param dataNodeId To which {@link MockDataNodeId} to connect
* @param sslSocketFactory the {@link SSLSocketFactory}.
* @param sslConfig the {@link SSLConfig}.
* @return ConnectedChannel
*/
private static ConnectedChannel getBlockingChannelBasedOnPortType(PortType portType, DataNodeId dataNodeId, SSLSocketFactory sslSocketFactory, SSLConfig sslConfig) {
ConnectedChannel channel = null;
String hostName = dataNodeId.getHostname();
if (portType == PortType.PLAINTEXT) {
channel = new BlockingChannel(hostName, dataNodeId.getPort(), 10000, 10000, 10000, 2000);
} else if (portType == PortType.SSL) {
channel = new SSLBlockingChannel(hostName, dataNodeId.getSSLPort(), new MetricRegistry(), 10000, 10000, 10000, 4000, sslSocketFactory, sslConfig);
} else if (portType == PortType.HTTP2) {
channel = new Http2BlockingChannel(hostName, dataNodeId.getHttp2Port(), sslConfig, new Http2ClientConfig(new VerifiableProperties(new Properties())), new Http2ClientMetrics(new MetricRegistry()));
}
return channel;
}
Aggregations