@Test
  public void testP2PLargeCredentialSucceeds() throws Exception {
    int locatorPort = getRandomAvailableTCPPort();

    final Host host = Host.getHost(0);
    final VM peer2 = host.getVM(1);
    final VM peer3 = host.getVM(2);

    CredentialGenerator gen = new DummyCredentialGenerator();
    gen.init();

    assertNotNull(gen.getAuthenticator());
    assertNull(gen.getJavaProperties());
    assertNull(gen.getSystemProperties());
    assertNotNull(gen.getValidCredentials(1));

    String authInit = UserPasswordWithExtraPropsAuthInit.class.getName() + ".create";
    Properties credentials = gen.getValidCredentials(1);

    Properties props = new Properties();
    props.setProperty(SECURITY_PEER_AUTH_INIT, authInit);
    props.setProperty(SECURITY_PEER_AUTHENTICATOR, gen.getAuthenticator());
    props.putAll(credentials);

    startTheLocator(props, null, locatorPort);

    try {
      // Start the first peer with huge credentials
      props = new Properties();
      props.setProperty(MCAST_PORT, "0");
      props.setProperty(LOCATORS, getIPLiteral() + "[" + locatorPort + "]");
      props.setProperty(SECURITY_PEER_AUTH_INIT, authInit);
      props.setProperty(SECURITY_PEER_AUTHENTICATOR, gen.getAuthenticator());

      String hugeStr = "20KString";
      for (int i = 0; i <= 20000; i++) {
        hugeStr += "A";
      }

      credentials = gen.getValidCredentials(3);
      credentials.setProperty("security-keep-extra-props", "-");
      credentials.setProperty("security-hugeentryone", hugeStr);
      credentials.setProperty("security-hugeentrytwo", hugeStr);
      credentials.setProperty("security-hugeentrythree", hugeStr);

      props.putAll(credentials);

      createDS(props, null);
      // fail("AuthenticationFailedException was expected as credentials were passed beyond 50k");
      // --?

      // Start the second peer with the same authenticator as locator
      props = new Properties();
      props.setProperty(MCAST_PORT, "0");
      props.setProperty(LOCATORS, getIPLiteral() + "[" + locatorPort + "]");
      props.setProperty(SECURITY_PEER_AUTH_INIT, authInit);
      props.setProperty(SECURITY_PEER_AUTHENTICATOR, gen.getAuthenticator());

      credentials = gen.getValidCredentials(7);
      props.putAll(credentials);

      createDS(peer2, props, null);
      createDS(peer3, props, null);

      // wait for view propagation
      pause(2000);

      // Verify the number of members on all peers and locator
      locatorVM.invoke(() -> verifyMembers(4));
      peer2.invoke(() -> verifyMembers(4));
      peer3.invoke(() -> verifyMembers(4));

      // Disconnect the peers
      disconnectFromDS();
      peer2.invoke(JUnit4DistributedTestCase::disconnectFromDS);
      peer3.invoke(JUnit4DistributedTestCase::disconnectFromDS);

    } finally {
      locatorVM.invoke(() -> stopLocator(locatorPort, ignoredExceptions));
    }
  }
The strategy is to test credential size greater than UDP datagram size.

Here locator will accept the credentials from peer2 and the large credential from the first
peer. Number of members in the DS should be four
geode-core/src/distributedTest/java/org/apache/geode/security/P2PAuthenticationDUnitTest.java