Skip to content

Commit

Permalink
addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rdhabalia committed Apr 15, 2020
1 parent db8d58b commit 542429b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;

import lombok.Cleanup;

public class ProxyProtocolTest extends TlsProducerConsumerBase {
private static final Logger log = LoggerFactory.getLogger(ProxyProtocolTest.class);

Expand All @@ -50,6 +52,7 @@ public void testSniProxyProtocol() throws Exception {
authParams.put("tlsKeyFile", TLS_CLIENT_KEY_FILE_PATH);
clientBuilder.authentication(AuthenticationTls.class.getName(), authParams);

@Cleanup
PulsarClient pulsarClient = clientBuilder.build();

// should be able to create producer successfully
Expand All @@ -73,6 +76,7 @@ public void testSniProxyProtocolWithInvalidProxyUrl() throws Exception {
authParams.put("tlsKeyFile", TLS_CLIENT_KEY_FILE_PATH);
clientBuilder.authentication(AuthenticationTls.class.getName(), authParams);

@Cleanup
PulsarClient pulsarClient = clientBuilder.build();

try {
Expand All @@ -93,11 +97,12 @@ public void testSniProxyProtocolWithoutTls() throws Exception {
ClientBuilder clientBuilder = PulsarClient.builder().serviceUrl(brokerServiceUrl)
.proxyServiceUrl(proxyUrl, ProxyProtocol.SNI).operationTimeout(1000, TimeUnit.MILLISECONDS);

@Cleanup
PulsarClient pulsarClient = clientBuilder.build();

try {
pulsarClient.newProducer().topic(topicName).create();
fail("should have failed due to invalid url");
fail("should have failed due to non-tls url");
} catch (PulsarClientException e) {
// Ok
}
Expand Down

0 comments on commit 542429b

Please sign in to comment.