});
}
final OAuth2CodeGrantFlow.Builder builder =
OAuth2ClientSupport.authorizationCodeGrantFlowBuilder(clientId, authUri, accessTokenUri);
final OAuth2CodeGrantFlow flow = builder
.client(client)
.refreshTokenUri(refreshTokenUri)
.property(OAuth2CodeGrantFlow.Phase.AUTHORIZATION, "readOnly", "true")
.property(OAuth2CodeGrantFlow.Phase.AUTHORIZATION, OAuth2Parameters.STATE, state)
.scope("contact")
.build();
final String finalAuthorizationUri = flow.start();
final Response response = ClientBuilder.newClient().target(finalAuthorizationUri).request().get();
assertEquals(200, response.getStatus());
final String code = response.readEntity(String.class);
assertEquals(CODE, code);
final TokenResult result = flow.finish(code, state);
assertEquals("access-token-aab999f", result.getAccessToken());
assertEquals(new Long(3600), result.getExpiresIn());
assertEquals("access-token", result.getTokenType());
final TokenResult refreshResult = flow.refreshAccessToken(result.getRefreshToken());
assertEquals("access-token-new", refreshResult.getAccessToken());
assertEquals(new Long(3600), refreshResult.getExpiresIn());
assertEquals("access-token", refreshResult.getTokenType());
if (isArray) {