Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:44:54+00:00 2026-06-13T16:44:54+00:00

Is there a way make the SSLSocket wait until the handshake is completed without

  • 0

Is there a way make the SSLSocket wait until the handshake is completed without using the addHandshakeListener() method? I would like it to block until it has completed the handshake.

Edit:
A little bit more clarification: a regular (Non-SSL) Socket is initially used (this is required, because a package must be sent to the server before the actual handshake takes place). This socket is “converted” into a SSLSocket using SSlSocketFactory.createSocket.
My question is that whether there is a way to now synchronously do the handshake.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:44:55+00:00Added an answer on June 13, 2026 at 4:44 pm

    SSLSocket.startHandshake() is a synchronous call when you start handshake between the peers very first time, it will block the calling thread until handshake has completed:

    ... ...
    
    // initial handshake between peers, don't need Listener:
    sslSocket.startHandshake(); // <- this will block the calling thread.
    // handshake is completed at this point
    
    ... ...
    

    This is not fully documented in Android API, see original Java API for the complete javadoc:

    Starts an SSL handshake on this connection. Common reasons include a need to use new encryption keys, to change cipher suites, or to initiate a new session. To force complete reauthentication, the current session could be invalidated before starting this handshake.

    If data has already been sent on the connection, it continues to flow during this handshake. When the handshake completes, this will be signaled with an event. This method is synchronous for the initial handshake on a connection and returns when the negotiated handshake is complete. Some protocols may not support multiple handshakes on an existing socket and may throw an IOException.

    The situation becomes pretty complicated if you manipulate handshake multiple times between the peers, it could be an asynchronous call in some cases (when you need Listener), check out this online document Fundamental Networking in Java for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there a way to make something like this Using only css and html?
Is there a way to make a string bolder in code behind using C#
is there way make swf like this : via AS?
Is there a way to make authentication into Codeigniter, only with username, not using
Is there a way to make this code work without a Warning? function myFunction($value,
I just wondering is there way to make a tab like shape border? To
Is there a way to make a button's background color change from a color
Is there a way to make MySQL cause some kind of error when doing
Is there a way to make Timeline start recording EXACTLY at the time where
Is there a way to make the SVG version of an image not being

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.