Search in sources :

Example 1 with Http2BlockingChannel

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;
}
Also used : Http2ClientMetrics(com.github.ambry.network.http2.Http2ClientMetrics) Http2BlockingChannel(com.github.ambry.network.http2.Http2BlockingChannel) VerifiableProperties(com.github.ambry.config.VerifiableProperties) MetricRegistry(com.codahale.metrics.MetricRegistry) ConnectedChannel(com.github.ambry.network.ConnectedChannel) Http2ClientConfig(com.github.ambry.config.Http2ClientConfig) BlobProperties(com.github.ambry.messageformat.BlobProperties) Properties(java.util.Properties) VerifiableProperties(com.github.ambry.config.VerifiableProperties) BlockingChannel(com.github.ambry.network.BlockingChannel) Http2BlockingChannel(com.github.ambry.network.http2.Http2BlockingChannel) SSLBlockingChannel(com.github.ambry.network.SSLBlockingChannel) SSLBlockingChannel(com.github.ambry.network.SSLBlockingChannel)

Aggregations

MetricRegistry (com.codahale.metrics.MetricRegistry)1 Http2ClientConfig (com.github.ambry.config.Http2ClientConfig)1 VerifiableProperties (com.github.ambry.config.VerifiableProperties)1 BlobProperties (com.github.ambry.messageformat.BlobProperties)1 BlockingChannel (com.github.ambry.network.BlockingChannel)1 ConnectedChannel (com.github.ambry.network.ConnectedChannel)1 SSLBlockingChannel (com.github.ambry.network.SSLBlockingChannel)1 Http2BlockingChannel (com.github.ambry.network.http2.Http2BlockingChannel)1 Http2ClientMetrics (com.github.ambry.network.http2.Http2ClientMetrics)1 Properties (java.util.Properties)1