Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,460,735
Community Members
 
Community Events
176
Community Groups

Java Jira Rest Client Socket Timeout Issue - 5.2.4

Hi,

While integrating with JIRA using the Java Rest client, I got a socket timeout issue. Based on the discussion on this forum, I tried to create my own Authentication Handler. But I am not sure, what attributes to set in Builder Object. Can you please help us with this?

 

import org.apache.commons.codec.binary.Base64;
import com.atlassian.httpclient.api.Request.Builder;
import com.atlassian.jira.rest.client.api.AuthenticationHandler;

public class JiraCustomHandler implements AuthenticationHandler {

private final String username;
private final String password;

public JiraCustomHandler(String username, String password) {
this.username = username;
this.password = password;
}

@Override

public void configure(Builder builder) {
builder.setAttribute("PROPERTY_CONNECT_TIMEOUT", "22000");
builder.setHeader("Authorization", "Basic " + encodeCredentials());
}

private String encodeCredentials() {
byte[] credentials = (this.username + ':' + this.password).getBytes();
return new String(Base64.encodeBase64(credentials));
}

}

0 answers

Suggest an answer

Log in or Sign up to answer