Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work connection to the https proxy #26

Closed
DaulGitHub opened this issue Feb 7, 2021 · 2 comments
Closed

Not work connection to the https proxy #26

DaulGitHub opened this issue Feb 7, 2021 · 2 comments

Comments

@DaulGitHub
Copy link

We use https proxy, on proxy_url:proxy_port
When executing, I get an error ConnectionException

This code not work for me

    val config = HttpConfig.getDefaultHttpConfig()
	.withTimeout(8000)
	.withIgnoreSSLVerification(true)
	.withProxyHost(proxy_url)
	.withProxyPort(proxy_port)
	.withProxyUsername(proxy_login)
	.withProxyPassword(proxy_password)
	.addHttpListener(HttpListener.forRequestListener {
	println(
		"REQUEST: ${it.httpMethod()} ${it.uri()} ${it.headers().map { kv -> "${kv.key} : ${kv.value}"}.joinToString(";")} ${it.body() ?: ""}"
	)
})

val credentials = BasicCredentials()
	.withAk(ak)
	.withSk(sk)
	.withProjectId(projectId)

val ctsClient = CtsClient.newBuilder()
	.withHttpConfig(config)
	.withCredential(credentials)
	.withEndpoint(ctsEndpoint)
	.build()

val vpcClient = VpcClient.newBuilder()
	.withHttpConfig(config)
	.withCredential(credentials)
	.withEndpoint(vpcEndpoint)
	.build()

println("VPC Service: listVpcs request was started")
val listVpcsResponse: ListVpcsResponse = vpcClient.listVpcs(ListVpcsRequest().withLimit(1))
println("VPC Service: the request was completed successfully")
println("response is: $listVpcsResponse")

println("CTS Service: listTraces request was started")
val response = ctsClient.listTraces(ListTracesRequest().withTraceType(ListTracesRequest.TraceTypeEnum.SYSTEM))
println("CTS Service: the request was completed successfully")
println("response is: $response")

}

@wuchen-huawei
Copy link
Collaborator

Sorry to tell you that our SDK doesn't support https proxy now, OkHttp is used as our middleware, and this issue hasn't been resolved by OkHttp, you could refer to HTTPS proxy is not supported.

We’ve looked up for related issues, maybe you could see if this issue would solve your problem.

If you have any other questions, please leave a message on this issue. We'll try to handle it as soon as possible.

@DaulGitHub
Copy link
Author

Thank you Wuchen!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants