test_class.file: google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/CloudShellCredentialTest.java
test_class.identifier: CloudShellCredentialTest
test_case.body: @Test
    public void refreshAccessToken() throws IOException{
      final ServerSocket authSocket = new ServerSocket(0);
      Runnable serverTask =
          new Runnable() {
            @Override
            public void run() {
              try {
                Socket clientSocket = authSocket.accept();
                BufferedReader input =
                    new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                String lines = input.readLine();
                lines += '\n' + input.readLine();
                assertEquals(CloudShellCredential.GET_AUTH_TOKEN_REQUEST, lines);
  
                PrintWriter out =
                    new PrintWriter(clientSocket.getOutputStream(), true);
                out.println("32\n[\"email\", \"project-id\", \"token\", 1234]");
              } catch (Exception reThrown) {
                throw new RuntimeException(reThrown);
              }
            }
          };
      Thread serverThread = new Thread(serverTask);
      serverThread.start();
  
      GoogleCredential creds = new CloudShellCredential(
          authSocket.getLocalPort(), GsonFactory.getDefaultInstance());
      assertEquals("token", creds.executeRefreshToken().getAccessToken());
    }
test_case.class_method_signature: CloudShellCredentialTest.refreshAccessToken()
test_case.full_signature: @Test public void refreshAccessToken()
test_case.identifier: refreshAccessToken
test_case.invocations: accept getInputStream readLine readLine assertEquals getOutputStream println start getLocalPort getDefaultInstance assertEquals getAccessToken executeRefreshToken
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void refreshAccessToken()
focal_class.declarator: ACCESS_TOKEN_INDEX = 2
focal_class.modifier: private static final
focal_class.original_string: private static final int ACCESS_TOKEN_INDEX = 2;
focal_class.type: int
focal_class.var_name: ACCESS_TOKEN_INDEX
focal_class.declarator: READ_TIMEOUT_MS = 5000
focal_class.modifier: private static final
focal_class.original_string: private static final int READ_TIMEOUT_MS = 5000;
focal_class.type: int
focal_class.var_name: READ_TIMEOUT_MS
focal_class.declarator: GET_AUTH_TOKEN_REQUEST = "2\n[]"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String GET_AUTH_TOKEN_REQUEST = "2\n[]";
focal_class.type: String
focal_class.var_name: GET_AUTH_TOKEN_REQUEST
focal_class.declarator: authPort
focal_class.modifier: private final
focal_class.original_string: private final int authPort;
focal_class.type: int
focal_class.var_name: authPort
focal_class.declarator: jsonFactory
focal_class.modifier: private final
focal_class.original_string: private final JsonFactory jsonFactory;
focal_class.type: JsonFactory
focal_class.var_name: jsonFactory
focal_class.file: google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/CloudShellCredential.java
focal_class.identifier: CloudShellCredential
focal_class.class_method_signature: CloudShellCredential.CloudShellCredential(int authPort, JsonFactory jsonFactory)
focal_class.full_signature: public  CloudShellCredential(int authPort, JsonFactory jsonFactory)
focal_class.identifier: CloudShellCredential
focal_class.modifiers: public
focal_class.parameters: (int authPort, JsonFactory jsonFactory)
focal_class.signature:  CloudShellCredential(int authPort, JsonFactory jsonFactory)
focal_class.class_method_signature: CloudShellCredential.getAuthPort()
focal_class.full_signature: protected int getAuthPort()
focal_class.identifier: getAuthPort
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getAuthPort()
focal_class.class_method_signature: CloudShellCredential.executeRefreshToken()
focal_class.full_signature: @Override protected TokenResponse executeRefreshToken()
focal_class.identifier: executeRefreshToken
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: TokenResponse
focal_class.signature: TokenResponse executeRefreshToken()
focal_class.superclass: extends GoogleCredential
focal_method.body: @Override
    protected TokenResponse executeRefreshToken()
        throws IOException {
      Socket socket = new Socket("localhost", this.getAuthPort());
      socket.setSoTimeout(READ_TIMEOUT_MS);
      TokenResponse token = new TokenResponse();
      try {
        PrintWriter out =
          new PrintWriter(socket.getOutputStream(), true);
        out.println(GET_AUTH_TOKEN_REQUEST);
  
        BufferedReader input =
            new BufferedReader(new InputStreamReader(socket.getInputStream()));
        // Ignore the size line
        input.readLine();
  
        Collection<Object> messageArray = jsonFactory.createJsonParser(input)
          .parseArray(LinkedList.class, Object.class);
        String accessToken = ((List<Object>) messageArray).get(ACCESS_TOKEN_INDEX).toString();
        token.setAccessToken(accessToken);
      } finally {
        socket.close();
      }
      return token;
    }
focal_method.class_method_signature: CloudShellCredential.executeRefreshToken()
focal_method.full_signature: @Override protected TokenResponse executeRefreshToken()
focal_method.identifier: executeRefreshToken
focal_method.invocations: getAuthPort setSoTimeout getOutputStream println getInputStream readLine parseArray createJsonParser toString get setAccessToken close
focal_method.modifiers: @Override protected
focal_method.parameters: ()
focal_method.return: TokenResponse
focal_method.signature: TokenResponse executeRefreshToken()